[CMake] CMake extracting tar via execute_process does not allow extraction in subdirectories

Saad Khattak saadrustam at gmail.com
Tue Apr 2 20:56:00 EDT 2013


Hi Eric,

I created the folder manually, but it still did not extract to that folder.
It appears to only be able to extract to the current folder. It 'is' able
to create folders that are in the tar as expected.

- Saad


On Tue, Apr 2, 2013 at 1:50 AM, Eric Noulard <eric.noulard at gmail.com> wrote:

>
>
>
> 2013/4/2 Saad Khattak <saadrustam at gmail.com>
>
>> Hi,
>>
>> If I have the following command:
>>
>>   execute_process(
>>     COMMAND ${CMAKE_COMMAND} -E tar xzf mySDK.tar.gz
>>     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
>>     )
>>
>> the extraction works and extracts the tar in the current directory. But
>> this:
>>
>>   execute_process(
>>     COMMAND ${CMAKE_COMMAND} -E tar xzf mySDK.tar.gz
>>     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/someSubdirectory
>>     )
>>
>> fails to extract into 'someDirectory' (even if it already exists -
>> although it 'should' create the directory for me).
>>
>
> No it shouldn't.
>
>
>>  Am I misunderstanding some commands?
>>
>
> Yes I think you misunderstand "WORKING_DIRECTORY" argument of
> "execute_process" command.
> The WORKING_DIRECTORY MUST exists beforehand and it is NOT the job of
> "execute_process"
> to create it.
>
> A "WORKING_DIRECTORY" is **always** supposed to exists when used
> by the cmake command providing this option like:
> add_custom_command, add_test or execute_process.
>
> If you need to create a directory you can "cmake -E make_directory"
> or "file(MAKE_DIRECTORY ...)"
>
> That said "cmake -E tar xzf mySDK.tar.gz" will create any directory found
> in the archive as expected.
> "working directory" for untar and "[possibly] top-level directory" created
> nby untar are not the same.
>
>
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130402/2923b8ab/attachment.htm>


More information about the CMake mailing list