Mirror of Awesome WM window manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Packaging.cmake 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. if(NOT VERSION)
  2. set(VERSION "unknown")
  3. endif()
  4. string(REGEX REPLACE "^v?([0-9.]+)-?(.*)$"
  5. "\\1;\\2" version_result ${VERSION})
  6. list(LENGTH version_result version_result_list_length)
  7. if(version_result_list_length EQUAL 2)
  8. list(GET version_result 0 version_num)
  9. list(GET version_result 1 version_gitstamp)
  10. else(version_result_list_length EQUAL 2)
  11. message("Unable to deduce a meaningful version number. \
  12. Set OVERRIDE_VERSION when you run CMake (cmake .. -DOVERRIDE_VERSION=3.14.159), or \
  13. just build from a git repository.")
  14. set(version_num "0.0.0")
  15. set(version_gitstamp "")
  16. endif(version_result_list_length EQUAL 2)
  17. if(version_gitstamp)
  18. set(version_gitsuffix "~git${version_gitstamp}")
  19. else(version_gitstamp)
  20. set(version_gitsuffix "")
  21. endif(version_gitstamp)
  22. string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
  23. "\\1;\\2;\\3" version_num_split ${version_num})
  24. list(APPEND version_num_split 0 0 0) #ensure the list(GET )) commands below never fail
  25. list(GET version_num_split 0 CPACK_PACKAGE_VERSION_MAJOR)
  26. list(GET version_num_split 1 CPACK_PACKAGE_VERSION_MINOR)
  27. list(GET version_num_split 2 CPACK_PACKAGE_VERSION_PATCH)
  28. set(version_num "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
  29. if(NOT DEFINED CPACK_GENERATOR)
  30. set(CPACK_GENERATOR)
  31. message(STATUS "Checking if 'package' target should be generated.")
  32. a_find_program(rpmbuild_path "rpmbuild" FALSE)
  33. if(rpmbuild_path)
  34. message(STATUS "rpmbuild found, enabling RPM for the 'package' target.")
  35. list(APPEND CPACK_GENERATOR RPM)
  36. else(rpmbuild_path)
  37. message(STATUS "The 'package' target will not build a RPM.")
  38. endif(rpmbuild_path)
  39. a_find_program(dpkg_path "dpkg" FALSE)
  40. if (dpkg_path)
  41. message(STATUS "dpkg found, enabling DEB for the 'package' target.")
  42. list(APPEND CPACK_GENERATOR DEB)
  43. else(dpkg_path)
  44. message(STATUS "The 'package' target will not build a DEB.")
  45. endif(dpkg_path)
  46. if(NOT CPACK_GENERATOR)
  47. message(STATUS "Skipping generation of 'package' target.")
  48. endif()
  49. endif(NOT DEFINED CPACK_GENERATOR)
  50. set(CPACK_GENERATOR ${CPACK_GENERATOR}
  51. CACHE STRING "Include CPack if non-empty (DEB and/or RPM).")
  52. if(CPACK_GENERATOR)
  53. message(STATUS "Package version will be set to ${version_num}${version_gitsuffix}.")
  54. set(CPACK_PACKAGE_VERSION "${version_num}${version_gitsuffix}")
  55. set(CPACK_PACKAGE_NAME "awesome")
  56. set(CPACK_DEBIAN_PACKAGE_MAINTAINER "devnull@example.com")
  57. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A tiling window manager")
  58. set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/etc/xdg;/usr/share/xsessions")
  59. include(CPack)
  60. endif()
  61. # vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80:foldmethod=marker