[CMake] CPack source packaging
Szőts Ákos
szotsaki at gmail.com
Wed Mar 6 04:01:07 EST 2013
Dear list members,
I made a project with CMake (2.8.10) on Linux and want to use CPack to create
its source .tar.bz2 file.
The task is really simple: copy all of the *.cpp and *.h files into the
.tar.bz2 file preserving the directory structure.
Although sounds really simple, I've yet to find a solution. The problems are:
- In the source directory goes the development also, producing a lot of other
files which are unneeded.
- With CPACK_SOURCE_IGNORE_FILES variable I can exclude some files, but without
the regexp positive lookahead feature I cannot say "exclude everything, except
for the *.cpp and *.h"
- Other solution would be an external command (eg. find and cp) to copy all the
files into an other temporary directory and set that directory as the source
directory. The drawback: there's no way to tell in CMakeLists.txt which is the
current CPack generator, so I simply can't write "if (CPACK_GENERATOR STREQUAL
"TBZ2")", because CPACK_GENERATOR is empty at "cmake ." time. So the find and
copy command either ran all the time or not even once.
- As a last resort I can execute a bz2 command which would do all the
necessary things, but that would run every time (see the problem above).
The command I issue to generate the source:
cpack --config CPackSourceConfig.cmake
Is there a simple solution to achieve this?
Best regards,
Ákos Szőts
More information about the CMake
mailing list