MantisBT - CMake
View Issue Details
0013515CMakeCMakepublic2012-09-05 05:282015-01-05 08:39
Joke de Buhr 
 
normalfeaturealways
closedfixed 
CMake 2.8.9 
CMake 3.1CMake 3.1 
0013515: ExternalProject doesn’t handle .tar.xz
ExternalProject doesn’t handle .tar.xz archives.

Cmake however knows how to extract .tar.xz archives. So ExternalProject should pass arguments to cmake.
ExternalProject_Add(libgnutls
    URL http://ftp.gnu.org/gnu/gnutls/gnutls-3.1.1.tar.xz [^]
    ...
)
Some external projects (like gnutls) do not provide tar.gz or tar.bz2 archives any more.
No tags attached.
related to 0013072closed  Allow CPack to generate tar.xz archives 
related to 0011040closed David Cole TXZ support to cpack 
has duplicate 0014318closed  ExternalProject module needs small patch to allow unpacking of *.tar.xz files 
related to 0014504closed  libarchive supports 7-Zip, Add 7-Zip support to cmake 
patch ExternalProject.cmake.patch (1,305) 2012-09-05 05:28
https://public.kitware.com/Bug/file/4453/ExternalProject.cmake.patch
patch ExternalProject.cmake.mohr.patch (4,356) 2012-12-13 16:36
https://public.kitware.com/Bug/file/4589/ExternalProject.cmake.mohr.patch
Issue History
2012-09-05 05:28Joke de BuhrNew Issue
2012-09-05 05:28Joke de BuhrFile Added: ExternalProject.cmake.patch
2012-09-05 06:42Eric NOULARDRelationship addedrelated to 0013072
2012-09-05 06:42Eric NOULARDRelationship addedrelated to 0011040
2012-09-05 06:44Eric NOULARDNote Added: 0030921
2012-09-05 06:52Joke de BuhrNote Added: 0030922
2012-09-05 07:13Eric NOULARDNote Added: 0030923
2012-09-05 07:17Joke de BuhrNote Added: 0030924
2012-12-13 16:36Andreas MohrFile Added: ExternalProject.cmake.mohr.patch
2012-12-13 16:43Andreas MohrNote Added: 0031880
2013-10-22 16:42Eric NOULARDRelationship addedrelated to 0014504
2014-04-09 15:20Brad KingRelationship addedhas duplicate 0014318
2014-04-10 13:56Brad KingNote Added: 0035670
2014-04-10 14:47irwinNote Added: 0035672
2014-07-30 09:39Brad KingNote Added: 0036501
2014-07-30 09:40Brad KingStatusnew => resolved
2014-07-30 09:40Brad KingResolutionopen => fixed
2014-07-30 09:40Brad KingFixed in Version => CMake 3.1
2014-07-30 09:40Brad KingTarget Version => CMake 3.1
2015-01-05 08:39Robert MaynardNote Added: 0037598
2015-01-05 08:39Robert MaynardStatusresolved => closed

Notes
(0030921)
Eric NOULARD   
2012-09-05 06:44   
You wrote:
> Cmake however knows how to extract .tar.xz archives

What makes you think xz can be handled by CMake?

AFAIK CMake has no builtin support for XZ/LZMA compression,
see related bug and discussion therein 0013072.

Which version of CMake are you using?
May be this is a distro-specific patched CMake version?
(0030922)
Joke de Buhr   
2012-09-05 06:52   
Cmake seems to handle tar.xz archives. At least it doesn’t seem to call the tar executable. But I may be wrong.

cmake -E tar xvfz gnutls-3.1.1.tar.xz


Fedora 17. Cmake 2.8.8
(0030923)
Eric NOULARD   
2012-09-05 07:13   
The F17 package must be built with --system-libs
which may pick-up system "zlib" and/or "libarchive"
which should include LZMA support.

You should be aware that it is not the case for every
linux distribution NOR windows version of CMake.
(0030924)
Joke de Buhr   
2012-09-05 07:17   
Nice to know. Thank you.

Nevertheless XZ support would be nice since more projects seem to provide .xz archives only.
(0031880)
Andreas Mohr   
2012-12-13 16:43   
I've added another variant of a .xz patch to ExternalProject.cmake.

It provides a central helper to calculate all currently supported archive type data, for (hopefully) easy one-liner addition of new archive types.
It fixes improper .bz2 check (this is about .tar.bz2 and *not* non-tar .bz2 only - there was no non-tar .gz support either). Dito for missing tbz2 extension.
"extract" for tarball filename analysis description is a misnomer when thinking about the "archive extract" process which is something entirely different.
It removes all use of duplicated open-coded semi-update-prone regex strings.

This patch has been lightly tested so far.
(0035670)
Brad King   
2014-04-10 13:56   
Another patch was submitted for this in 0014318.

The basic problem with all of this is that "cmake -E tar" does not portably support lzma currently. In order to do that we need to bring liblzma into the CMake Utilities/ source tree as discussed in 0014504. However, liblzma is implemented in C99 which is not supported by all compilers supported by CMake.
(0035672)
irwin   
2014-04-10 14:47   
@Brad. I don't get your logic for not accepting either the patch here or my patch at 0014504.

I have just checked, and the command

cmake -E tar xfz test.tar.xz

works fine to unpack a simple *.tar.xz tarball on both Linux (with version 2.8.12.1) and MSYS (also with 2.8.12.1).

I accept your word there are other platforms where the above command does not work (yet), but both Linux and MSYS are big platforms so accepting a simple patch to ExternalProject.cmake to take advantage of this existing cmake -E functionality adds a lot of useful capability (now) and even more capability in the future when the other platforms work properly. So why not?
(0036501)
Brad King   
2014-07-30 09:39   
After a contributor ported liblzma to C89/90 for us we are finally able to implement lzma support in ExternalProject:

 ExternalProject: Recognize lzma-compressed files
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56e6975c [^]

While at it I also added .tbz2 extension support also mentioned in ExternalProject.cmake.mohr.patch:

 ExternalProject: Recognize .tbz2 extension
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98ea0344 [^]
(0037598)
Robert Maynard   
2015-01-05 08:39   
Closing resolved issues that have not been updated in more than 4 months