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.
54 lines
1.6 KiB
54 lines
1.6 KiB
6 years ago
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||
|
|
||
6 years ago
|
if(NOT "${CPACK_EXTERNAL_REQUESTED_VERSIONS}" STREQUAL "")
|
||
6 years ago
|
unset(_found_major)
|
||
|
|
||
6 years ago
|
foreach(_req_version IN LISTS CPACK_EXTERNAL_REQUESTED_VERSIONS)
|
||
6 years ago
|
if(_req_version MATCHES "^([0-9]+)\\.([0-9]+)$")
|
||
|
set(_req_major "${CMAKE_MATCH_1}")
|
||
|
set(_req_minor "${CMAKE_MATCH_2}")
|
||
|
|
||
6 years ago
|
foreach(_known_version IN LISTS CPACK_EXTERNAL_KNOWN_VERSIONS)
|
||
6 years ago
|
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)
|
||
6 years ago
|
set(CPACK_EXTERNAL_SELECTED_MAJOR "${_found_major}")
|
||
|
set(CPACK_EXTERNAL_SELECTED_MINOR "${_found_minor}")
|
||
|
set(CPACK_EXTERNAL_SELECTED_VERSION "${_found_major}.${_found_minor}")
|
||
6 years ago
|
else()
|
||
|
message(FATAL_ERROR
|
||
6 years ago
|
"Could not find a suitable version in CPACK_EXTERNAL_REQUESTED_VERSIONS"
|
||
6 years ago
|
)
|
||
|
endif()
|
||
|
else()
|
||
6 years ago
|
list(GET CPACK_EXTERNAL_KNOWN_VERSIONS 0 CPACK_EXTERNAL_SELECTED_VERSION)
|
||
6 years ago
|
string(REGEX MATCH
|
||
|
"^([0-9]+)\\.([0-9]+)$"
|
||
|
_dummy
|
||
6 years ago
|
"${CPACK_EXTERNAL_SELECTED_VERSION}"
|
||
6 years ago
|
)
|
||
6 years ago
|
set(CPACK_EXTERNAL_SELECTED_MAJOR "${CMAKE_MATCH_1}")
|
||
|
set(CPACK_EXTERNAL_SELECTED_MINOR "${CMAKE_MATCH_2}")
|
||
6 years ago
|
endif()
|