2 # vcpkg_minimum_required
4 Asserts that the version of the vcpkg program being used to build a port is later than the supplied date, inclusive.
8 vcpkg_minimum_required(VERSION 2021-01-13)
13 The date-version to check against.
16 function(vcpkg_minimum_required)
17 cmake_parse_arguments(PARSE_ARGV 0 _vcpkg "" "VERSION" "")
18 if (NOT DEFINED VCPKG_BASE_VERSION)
20 "Your vcpkg executable is outdated and is not compatible with the current CMake scripts. "
21 "Please re-acquire vcpkg by running bootstrap-vcpkg."
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}")
28 "vcpkg internal failure; \${VCPKG_BASE_VERSION} (${VCPKG_BASE_VERSION}) was not a valid date."
32 if (NOT _vcpkg_VERSION MATCHES "${_vcpkg_date_regex}")
34 "VERSION parameter to vcpkg_minimum_required was not a valid date. "
35 "Comparing with vcpkg tool version ${_vcpkg_matched_base_version}"
39 string(REPLACE "-" "." _VCPKG_BASE_VERSION_as_dotted "${VCPKG_BASE_VERSION}")
40 string(REPLACE "-" "." _vcpkg_VERSION_as_dotted "${_vcpkg_VERSION}")
42 if (_VCPKG_BASE_VERSION_as_dotted VERSION_LESS _vcpkg_VERSION_as_dotted)
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."