[chrome-gnome-shell/gnome/migration: 2/2] cmake: added dist target



commit ed8f33276f0edc457b40269574a8bfd168e381ff
Author: Yuri Konotopov <ykonotopov gmail com>
Date:   Sun Mar 6 11:29:58 2016 +0300

    cmake: added dist target

 .gitattributes |    3 +++
 CMakeLists.txt |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..150351e
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+.gitattributes export-ignore
+.gitignore export-ignore
+/chrome-web-store export-ignore
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 520888a..95abc3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,11 @@
 cmake_minimum_required (VERSION 2.8)
 project (chrome-gnome-shell NONE)
 
+set(PROJECT_VERSION "5.1")
+
+set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
+set(ARCHIVE_FULL_NAME ${ARCHIVE_NAME}.tar.xz)
+
 option(BUILD_EXTENSION "Build extension zip package"   TRUE)
 option(BUILD_CONNECTOR "Build native messaging host"   TRUE)
 
@@ -40,3 +45,13 @@ if(BUILD_CONNECTOR)
        install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/connector/external_extension.json" DESTINATION 
"/usr/share/google-chrome/extensions/" RENAME "${EXTENSION_ID}.json")
        install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/connector/external_extension.json" DESTINATION 
"/usr/share/chromium/extensions/" RENAME "${EXTENSION_ID}.json")
 endif(BUILD_CONNECTOR)
+
+find_program(XZ xz)
+if(XZ)
+       # http://agateau.com/2009/cmake-and-make-dist-the-simple-version/
+       add_custom_target(dist
+               COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | xz -z > 
${CMAKE_BINARY_DIR}/${ARCHIVE_FULL_NAME}
+               WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+else(XZ)
+       message(WARNING "XZ utils not found. Dist target will not be generated.")
+endif(XZ)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]