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

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}") 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}.") if(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR)
set(CPACK_PACKAGE_VERSION "${version_num}${version_gitsuffix}") message(STATUS "Checking if 'package' target should be generated.")
if(NOT CPACK_GENERATOR)
a_find_program(rpmbuild_path "rpmbuild" FALSE) a_find_program(rpmbuild_path "rpmbuild" FALSE)
if(rpmbuild_path) 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) list(APPEND CPACK_GENERATOR RPM)
else(rpmbuild_path) 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) endif(rpmbuild_path)
a_find_program(dpkg_path "dpkg" FALSE) a_find_program(dpkg_path "dpkg" FALSE)
if (dpkg_path) 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) list(APPEND CPACK_GENERATOR DEB)
else(dpkg_path) 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(dpkg_path)
endif(NOT CPACK_GENERATOR)
set(CPACK_PACKAGE_NAME "awesome") if(NOT CPACK_GENERATOR)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "devnull@example.com") message(STATUS "Skipping generation of 'package' target.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A tiling window manager") endif()
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/etc/xdg;/usr/share/xsessions") endif(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR ${CPACK_GENERATOR}
CACHE STRING "Include CPack if non-empty (DEB and/or RPM).")
if(CPACK_GENERATOR) 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) include(CPack)
endif() endif()