added target "dist" to CMakeLists.txt, which uses "git archive" to build source tarball
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 12 Nov 2014 14:36:20 +0000 (15:36 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 12 Nov 2014 14:36:20 +0000 (15:36 +0100)
CMakeLists.txt

index 3ed3f29..744c8d7 100644 (file)
@@ -38,6 +38,13 @@ set(CPACK_SOURCE_IGNORE_FILES
 )
 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${TARGET}-${VERSION}")
 
+# "make dist" target
+set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
+add_custom_target(dist
+    COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
+            | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
 # cmake: build the application in the source directory
 add_subdirectory(src)