2013/3/6 Szőts Ákos <[email protected]>: > 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.
If you say so, may be you are building in-source. Did you try out-of-source build? http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees If you are already doing out-of-source build and want to exclude some other files then CPACK_SOURCE_IGNORE_FILES should be the way to go. > - 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" Yes, unfortunately there is no "CPACK_SOURCE_INCLUDE_FILES". > - 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. You'll have to implement CPack time copy, you may do that inside a CPACK_PROJECT_CONFIG_FILE. see: http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29 However I don't think it's the best solution in your case. > - 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? Like I said, out-of-source, should be the easy way to achieve what you want. Another way to have a "clean" copy would be to use your VCS e.g. svn export + tar/zip/.... in a custom_command cvs export + tar/zip/.... in a custom_command git archive ... see: http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
