Packaging.cmake: cache CPACK_GENERATOR (#1924)

This commit is contained in:
Daniel Hahler 2017-07-21 01:06:59 +02:00 committed by GitHub
parent 458981710c
commit 58bb3dde4a
1 changed files with 19 additions and 14 deletions

View File

@ -35,34 +35,39 @@ list(GET version_num_split 2 CPACK_PACKAGE_VERSION_PATCH)
set(version_num "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
message(STATUS "Package version will be set to ${version_num}${version_gitsuffix}.")
set(CPACK_PACKAGE_VERSION "${version_num}${version_gitsuffix}")
if(NOT CPACK_GENERATOR)
if(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR)
message(STATUS "Checking if 'package' target should be generated.")
a_find_program(rpmbuild_path "rpmbuild" FALSE)
if(rpmbuild_path)
message(STATUS "rpmbuild found, enabling RPM for the 'package' target")
message(STATUS "rpmbuild found, enabling RPM for the 'package' target.")
list(APPEND CPACK_GENERATOR RPM)
else(rpmbuild_path)
message(STATUS "The 'package' target will not build a RPM")
message(STATUS "The 'package' target will not build a RPM.")
endif(rpmbuild_path)
a_find_program(dpkg_path "dpkg" FALSE)
if (dpkg_path)
message(STATUS "dpkg found, enabling DEB for the 'package' target")
message(STATUS "dpkg found, enabling DEB for the 'package' target.")
list(APPEND CPACK_GENERATOR DEB)
else(dpkg_path)
message(STATUS "The 'package' target will not build a DEB")
message(STATUS "The 'package' target will not build a DEB.")
endif(dpkg_path)
endif(NOT CPACK_GENERATOR)
set(CPACK_PACKAGE_NAME "awesome")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "devnull@example.com")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A tiling window manager")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/etc/xdg;/usr/share/xsessions")
if(NOT CPACK_GENERATOR)
message(STATUS "Skipping generation of 'package' target.")
endif()
endif(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR ${CPACK_GENERATOR}
CACHE STRING "Include CPack if non-empty (DEB and/or RPM).")
if(CPACK_GENERATOR)
message(STATUS "Package version will be set to ${version_num}${version_gitsuffix}.")
set(CPACK_PACKAGE_VERSION "${version_num}${version_gitsuffix}")
set(CPACK_PACKAGE_NAME "awesome")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "devnull@example.com")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A tiling window manager")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/etc/xdg;/usr/share/xsessions")
include(CPack)
endif()