[cmake-developers] ExternalProject EXTRACT_COMMAND (was: New feature, git access)

Brad King brad.king at kitware.com
Tue Nov 26 10:26:14 EST 2013


On 11/25/2013 07:01 PM, Pau Garcia i Quiles wrote:
> I have implemented an EXTRACT_COMMAND for ExternalProject_Add. 
> 
> It is useful in case you are downloading a file that CMake does
> not know how to extract, but you do (e. g. NSIS installers that
> can be extracted without installation, self-extracting ZIP files, etc). 
>
> Code is here for now:
> 
> https://elpauer.assembla.com/code/elpauercmake/git/nodes/epa_extract_command
> 
> A test has been implemented. Run "git diff master epa_extract_command" to
> see the changes, which are not really that important.

Thanks for working on this.  I squashed the topic into a single commit
and attached the patch for reference here.  As I state in the commit
message it is useful to be able to re-use the builtin download command
and just substitute the extraction command.

The test fails for me with spaces in the path because you're writing
the extraction command into the script without quoting so the spaces
cause incorrect parsing at build time.  You can write it as

 file(WRITE ... "
 ...
 set(extract_command "${extract_command}")
 ...
 ... COMMAND \${extract_command} ...
 ...
 ")

so that the exact value of the command is stored in the script and
expanded when evaluated at build time.  It is probably simplest to
refactor the default extraction command to be written into the script
in this way also.  Then you simply don't generate the default when an
explicit command is passed.

The EXTRACT_COMMAND needs a way to have a placeholder for the file name
so that the caller does not need to know where ExternalProject keeps
the file after downloading.

> I don't understand the "...After you have been invited..."
> in http://www.cmake.org/Wiki/CMake/Git/Account#Git
> (who would know I need an invitation!?)

The sentence immediately preceding that says  "See our new maintainer
instructions to join" and has a link to the instructions.  They have
a step for posting to this list for discussion.  We invite productive
contributors for direct access in due time.

-Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ExternalProject-Add-EXTRACT_COMMAND-option.patch
Type: text/x-diff
Size: 7936 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20131126/4f1f135a/attachment-0001.patch>


More information about the cmake-developers mailing list