theBigCheese88
theBigCheese88

Reputation: 452

cmake tar extract tar.gz without including the root directory

- files.tar.gz
    - file1
    - file2
    - files_3
        - file3

After extraction it should be:

- file1
- file2
- files3
    - file3

The same question has been asked like here: https://superuser.com/questions/899684/how-to-untar-an-archive-without-the-root-folder-but-keeping-the-full-hierarchy

However the issue is I want to do this from within cmake.

${CMAKE_COMMAND} -E tar

see: https://cmake.org/cmake/help/latest/manual/cmake.1.html

CMAKE_COMMAND is too primitive. For example it doesn't even support the -C flag. There is the custom_command but I rather not complicate the cmake file even more. Especially when this is such a basic functionality.

Upvotes: 0

Views: 40

Answers (0)

Related Questions