One reader of mine suggested that I can posted my finding to Fedora Wiki, but I don’t know how. Would you kind enough to tell me where do I start, thanks.
Nevertheless, my previous post does not show the whole method of junk-filtering in CMake/CPack. Following example demonstrates how to use CPack in CMake:
### Package configuration
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "<project name>")
SET(CPACK_PACKAGE_VENDOR "<vendor name>")
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE
${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
SET(CPACK_RESOURCE_FILE_LICENSE
${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER)
SET(CPACK_PACKAGE_VERSION_MAJOR <PROJECT_VER_MAJOR>)
SET(CPACK_PACKAGE_VERSION_MINOR <PROJECT_VER_MINOR>)
SET(CPACK_PACKAGE_VERSION_PATCH <PROJECT_VER_PATCH>)
|
SET(COMMON_IGNORE_FILES "/CMakeFiles/" "/Testing/" "/.svn/" "/CVS/" "_CPack_Packages/"
".cmake$" "~" ".swp" ".log" ".gz" ".directory$" "CMakeCache.txt")
SET(PRJ_COMMON_IGNORE_FILES ${COMMON_IGNORE_FILES} <PROJECT_SPECIFIC_IGNORE_FILES_PATTERN> )
SET(CPACK_SOURCE_IGNORE_FILES ${PRJ_COMMON_IGNORE_FILES}
<FILES_PATTERN_THAT_YOU_DONT_WANT_TO_PUT_IN_SOURCE_TARBALL>)
SET(CPACK_PACKAGE_IGNORE_FILES ${PRJ_COMMON_IGNORE_FILES} <FILES_PATTERN_THAT_YOU_DONT_WANT_TO_PUT_IN_BINARY_TARBALL> )
SET(CPACK_SOURCE_GENERATOR "TGZ")
INCLUDE(CPack)
|
Note that COMMON_IGNORE_FILES
,PRJ_COMMON_IGNORE_FILES
are my own variable, you can choose the name you like.
After executed cmake <project dir>
you can see the make targets by typing make help
......
... package
... package_source
......
|
Use make package
for binary package, and
make package_source
for source tarball.