]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/scripts/cmake/vcpkg_minimum_required.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / scripts / cmake / vcpkg_minimum_required.cmake
1 #[===[.md:
2 # vcpkg_minimum_required
3
4 Asserts that the version of the vcpkg program being used to build a port is later than the supplied date, inclusive.
5
6 ## Usage
7 ```cmake
8 vcpkg_minimum_required(VERSION 2021-01-13)
9 ```
10
11 ## Parameters
12 ### VERSION
13 The date-version to check against.
14 #]===]
15
16 function(vcpkg_minimum_required)
17 cmake_parse_arguments(PARSE_ARGV 0 _vcpkg "" "VERSION" "")
18 if (NOT DEFINED VCPKG_BASE_VERSION)
19 message(FATAL_ERROR
20 "Your vcpkg executable is outdated and is not compatible with the current CMake scripts. "
21 "Please re-acquire vcpkg by running bootstrap-vcpkg."
22 )
23 endif()
24
25 set(_vcpkg_date_regex "^[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]$")
26 if (NOT VCPKG_BASE_VERSION MATCHES "${_vcpkg_date_regex}")
27 message(FATAL_ERROR
28 "vcpkg internal failure; \${VCPKG_BASE_VERSION} (${VCPKG_BASE_VERSION}) was not a valid date."
29 )
30 endif()
31
32 if (NOT _vcpkg_VERSION MATCHES "${_vcpkg_date_regex}")
33 message(FATAL_ERROR
34 "VERSION parameter to vcpkg_minimum_required was not a valid date. "
35 "Comparing with vcpkg tool version ${_vcpkg_matched_base_version}"
36 )
37 endif()
38
39 string(REPLACE "-" "." _VCPKG_BASE_VERSION_as_dotted "${VCPKG_BASE_VERSION}")
40 string(REPLACE "-" "." _vcpkg_VERSION_as_dotted "${_vcpkg_VERSION}")
41
42 if (_VCPKG_BASE_VERSION_as_dotted VERSION_LESS _vcpkg_VERSION_as_dotted)
43 message(FATAL_ERROR
44 "Your vcpkg executable is from ${VCPKG_BASE_VERSION} which is older than required by the caller "
45 "of vcpkg_minimum_required (${_vcpkg_VERSION}). "
46 "Please re-acquire vcpkg by running bootstrap-vcpkg."
47 )
48 endif()
49 endfunction()