SgCPack.cmake 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #.rst:
  2. # SgCPack
  3. # -------
  4. #
  5. # CPack variables for the Sagui library packaging distribution.
  6. #
  7. # Adds the CPack targets to generate the distribution package of the Sagui
  8. # library. An extra added target `make dist` is just an intuitive alias to the
  9. # `make package_source`.
  10. # _
  11. # ___ __ _ __ _ _ _(_)
  12. # / __|/ _` |/ _` | | | | |
  13. # \__ \ (_| | (_| | |_| | |
  14. # |___/\__,_|\__, |\__,_|_|
  15. # |___/
  16. #
  17. # Cross-platform library which helps to develop web servers or frameworks.
  18. #
  19. # Copyright (C) 2016-2021 Silvio Clecio <[email protected]>
  20. #
  21. # Sagui library is free software; you can redistribute it and/or
  22. # modify it under the terms of the GNU Lesser General Public
  23. # License as published by the Free Software Foundation; either
  24. # version 2.1 of the License, or (at your option) any later version.
  25. #
  26. # Sagui library is distributed in the hope that it will be useful,
  27. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  29. # Lesser General Public License for more details.
  30. #
  31. # You should have received a copy of the GNU Lesser General Public
  32. # License along with Sagui library; if not, write to the Free Software
  33. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  34. #
  35. if(__SG_CPACK_INCLUDED)
  36. return()
  37. endif()
  38. set(__SG_CPACK_INCLUDED ON)
  39. set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
  40. set(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}")
  41. set(CPACK_PACKAGE_VERSION_MAJOR ${SG_VERSION_MAJOR})
  42. set(CPACK_PACKAGE_VERSION_MINOR ${SG_VERSION_MINOR})
  43. set(CPACK_PACKAGE_VERSION_PATCH ${SG_VERSION_PATCH})
  44. set(CPACK_PACKAGE_VERSION
  45. "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
  46. )
  47. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
  48. "${CPACK_PACKAGE_NAME} ${PROJECT_DESCRIPTION}")
  49. set(CPACK_PACKAGE_FILE_NAME "lib${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
  50. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
  51. set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
  52. set(CPACK_STRIP_FILES "${CMAKE_BINARY_DIR}")
  53. if(NOT CPACK_GENERATOR)
  54. set(CPACK_GENERATOR "TGZ;ZIP")
  55. endif()
  56. set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
  57. if(NOT CPACK_SOURCE_GENERATOR)
  58. set(CPACK_SOURCE_GENERATOR ${CPACK_GENERATOR})
  59. endif()
  60. if(NOT CPACK_SOURCE_IGNORE_FILES)
  61. set(CPACK_SOURCE_IGNORE_FILES
  62. "${CMAKE_BINARY_DIR}/"
  63. "/.idea/"
  64. "/.git/"
  65. "/.github/"
  66. "/build/"
  67. "/docs/"
  68. "/lib/"
  69. ".clang-format"
  70. ".cmake-format"
  71. ".editorconfig"
  72. ".gitignore"
  73. ".markdownlint.json"
  74. "_config.yml"
  75. "cmake-build-*")
  76. endif()
  77. add_custom_target(dist COMMAND ${CMAKE_BUILD_TOOL} package_source)
  78. include(CPack)