summaryrefslogtreecommitdiffstats
path: root/Modules/Internal
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-06-08 19:14:10 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2018-07-02 13:51:02 (GMT)
commit80914d88da3e5c997158fd3cc703a39b6673f780 (patch)
tree5b472c13d547f5b2d8e3c7c4d92f96b912c899ab /Modules/Internal
parent3ced881db63a97eb402bd68be5e45298371f4519 (diff)
downloadCMake-80914d88da3e5c997158fd3cc703a39b6673f780.zip
CMake-80914d88da3e5c997158fd3cc703a39b6673f780.tar.gz
CMake-80914d88da3e5c997158fd3cc703a39b6673f780.tar.bz2
CPack: Add "CPack External" generator
This generator doesn't actually package the files. Instead, it provides a metadata JSON file that can be used by external packaging software to do its own packaging. This JSON file provides information about the components, component groups, installation types, and CMake projects.
Diffstat (limited to 'Modules/Internal')
-rw-r--r--Modules/Internal/CPack/CPackExt.cmake53
1 files changed, 53 insertions, 0 deletions
diff --git a/Modules/Internal/CPack/CPackExt.cmake b/Modules/Internal/CPack/CPackExt.cmake
new file mode 100644
index 0000000..e52d978
--- /dev/null
+++ b/Modules/Internal/CPack/CPackExt.cmake
@@ -0,0 +1,53 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(NOT "${CPACK_EXT_REQUESTED_VERSIONS}" STREQUAL "")
+ unset(_found_major)
+
+ foreach(_req_version IN LISTS CPACK_EXT_REQUESTED_VERSIONS)
+ if(_req_version MATCHES "^([0-9]+)\\.([0-9]+)$")
+ set(_req_major "${CMAKE_MATCH_1}")
+ set(_req_minor "${CMAKE_MATCH_2}")
+
+ foreach(_known_version IN LISTS CPACK_EXT_KNOWN_VERSIONS)
+ string(REGEX MATCH
+ "^([0-9]+)\\.([0-9]+)$"
+ _known_version_dummy
+ "${_known_version}"
+ )
+
+ set(_known_major "${CMAKE_MATCH_1}")
+ set(_known_minor "${CMAKE_MATCH_2}")
+
+ if(_req_major EQUAL _known_major AND NOT _known_minor LESS _req_minor)
+ set(_found_major "${_known_major}")
+ set(_found_minor "${_known_minor}")
+ break()
+ endif()
+ endforeach()
+
+ if(DEFINED _found_major)
+ break()
+ endif()
+ endif()
+ endforeach()
+
+ if(DEFINED _found_major)
+ set(CPACK_EXT_SELECTED_MAJOR "${_found_major}")
+ set(CPACK_EXT_SELECTED_MINOR "${_found_minor}")
+ set(CPACK_EXT_SELECTED_VERSION "${_found_major}.${_found_minor}")
+ else()
+ message(FATAL_ERROR
+ "Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS"
+ )
+ endif()
+else()
+ list(GET CPACK_EXT_KNOWN_VERSIONS 0 CPACK_EXT_SELECTED_VERSION)
+ string(REGEX MATCH
+ "^([0-9]+)\\.([0-9]+)$"
+ _dummy
+ "${CPACK_EXT_SELECTED_VERSION}"
+ )
+ set(CPACK_EXT_SELECTED_MAJOR "${CMAKE_MATCH_1}")
+ set(CPACK_EXT_SELECTED_MINOR "${CMAKE_MATCH_2}")
+endif()