mb11193
(Matt)
1
I am running CMake v3.20.0 and trying to do the following:
# Create .zip archive of the project
add_custom_target(
package
COMMAND ${CMAKE_COMMAND} -E tar -cfv "${PROJECT_NAME}-source.tar"
--exclude="build" -C ${CMAKE_SOURCE_DIR}/*
)
Unfortunately, I’m getting this error:
CMake Error: Unknown option to -E tar: --exclude=build
I tried a lot of ways of re-arranging stuff - to no avail.
The command works outside of CMake so I’m not sure what I’m doing wrong here
fenrir
(Jakub Zakrzewski)
2
That’s interesting because CMake documentation (https://cmake.org/cmake/help/v3.20/manual/cmake.1.html#run-a-command-line-tool) does not list --exclude
as an option. Can it be that what you’ve tried outside CMake is tar...
and not cmake -E tar...
?
1 Like
mb11193
(Matt)
3
Hi Jakub,
I got confused between “tar” and “cmake -E tar” because I thought that they were the same thing.
Now I understand the difference in the documentation.
After removing “cmake -E”, the --exclude option worked.
Thanks!