Browse Source

Packaging.cmake: cache CPACK_GENERATOR (#1924)

Daniel Hahler 2 years ago
parent
commit
58bb3dde4a
1 changed files with 19 additions and 14 deletions
  1. 19
    14
      Packaging.cmake

+ 19
- 14
Packaging.cmake View File

@@ -35,34 +35,39 @@ list(GET version_num_split 2 CPACK_PACKAGE_VERSION_PATCH)
35 35
 
36 36
 set(version_num "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
37 37
 
38
-message(STATUS "Package version will be set to ${version_num}${version_gitsuffix}.")
39
-
40
-set(CPACK_PACKAGE_VERSION "${version_num}${version_gitsuffix}")
41
-
42
-if(NOT CPACK_GENERATOR)
38
+if(NOT DEFINED CPACK_GENERATOR)
39
+    set(CPACK_GENERATOR)
40
+    message(STATUS "Checking if 'package' target should be generated.")
43 41
     a_find_program(rpmbuild_path "rpmbuild" FALSE)
44 42
     if(rpmbuild_path)
45
-        message(STATUS "rpmbuild found, enabling RPM for the 'package' target")
43
+        message(STATUS "rpmbuild found, enabling RPM for the 'package' target.")
46 44
         list(APPEND CPACK_GENERATOR RPM)
47 45
     else(rpmbuild_path)
48
-        message(STATUS "The 'package' target will not build a RPM")
46
+        message(STATUS "The 'package' target will not build a RPM.")
49 47
     endif(rpmbuild_path)
50 48
 
51 49
     a_find_program(dpkg_path "dpkg" FALSE)
52 50
     if (dpkg_path)
53
-        message(STATUS "dpkg found, enabling DEB for the 'package' target")
51
+        message(STATUS "dpkg found, enabling DEB for the 'package' target.")
54 52
         list(APPEND CPACK_GENERATOR DEB)
55 53
     else(dpkg_path)
56
-        message(STATUS "The 'package' target will not build a DEB")
54
+        message(STATUS "The 'package' target will not build a DEB.")
57 55
     endif(dpkg_path)
58
-endif(NOT CPACK_GENERATOR)
59 56
 
60
-set(CPACK_PACKAGE_NAME "awesome")
61
-set(CPACK_DEBIAN_PACKAGE_MAINTAINER "devnull@example.com")
62
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A tiling window manager")
63
-set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/etc/xdg;/usr/share/xsessions")
57
+    if(NOT CPACK_GENERATOR)
58
+        message(STATUS "Skipping generation of 'package' target.")
59
+    endif()
60
+endif(NOT DEFINED CPACK_GENERATOR)
61
+set(CPACK_GENERATOR ${CPACK_GENERATOR}
62
+    CACHE STRING "Include CPack if non-empty (DEB and/or RPM).")
64 63
 
65 64
 if(CPACK_GENERATOR)
65
+    message(STATUS "Package version will be set to ${version_num}${version_gitsuffix}.")
66
+    set(CPACK_PACKAGE_VERSION "${version_num}${version_gitsuffix}")
67
+    set(CPACK_PACKAGE_NAME "awesome")
68
+    set(CPACK_DEBIAN_PACKAGE_MAINTAINER "devnull@example.com")
69
+    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A tiling window manager")
70
+    set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/etc/xdg;/usr/share/xsessions")
66 71
     include(CPack)
67 72
 endif()
68 73
 

Loading…
Cancel
Save