mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-26 19:58:59 +08:00
7d2449c346
* [docs] Delete embedded documentation in favor of docs/ Drive-by for the helper ports: 1. "documentation": "https://vcpkg.io/en/docs/README.html" 2. "license": "MIT" 3. Use `include_guard(GLOBAL)` in all script files 4. Make sure any persistent variables are saved to the cache * [docs] Restore empty regenerate.ps1 to satisfy Azure Pipelines * [docs] PR comments
36 lines
1.4 KiB
CMake
36 lines
1.4 KiB
CMake
function(vcpkg_minimum_required)
|
|
cmake_parse_arguments(PARSE_ARGV 0 arg "" "VERSION" "")
|
|
if(NOT DEFINED VCPKG_BASE_VERSION)
|
|
message(FATAL_ERROR "Your vcpkg executable is outdated and is not compatible with the current CMake scripts.
|
|
Please re-acquire vcpkg by running bootstrap-vcpkg."
|
|
)
|
|
endif()
|
|
if(NOT DEFINED arg_VERSION)
|
|
message(FATAL_ERROR "VERSION must be specified")
|
|
endif()
|
|
|
|
set(vcpkg_date_regex "^[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]$")
|
|
if(NOT "${VCPKG_BASE_VERSION}" MATCHES "${vcpkg_date_regex}")
|
|
message(FATAL_ERROR
|
|
"vcpkg internal failure; VCPKG_BASE_VERSION (${VCPKG_BASE_VERSION}) was not a valid date."
|
|
)
|
|
endif()
|
|
|
|
if(NOT "${arg_VERSION}" MATCHES "${vcpkg_date_regex}")
|
|
message(FATAL_ERROR
|
|
"VERSION (${arg_VERSION}) was not a valid date - expected something of the form 'YYYY-MM-DD'"
|
|
)
|
|
endif()
|
|
|
|
string(REPLACE "-" "." VCPKG_BASE_VERSION_as_dotted "${VCPKG_BASE_VERSION}")
|
|
string(REPLACE "-" "." arg_VERSION_as_dotted "${arg_VERSION}")
|
|
|
|
if("${VCPKG_BASE_VERSION_as_dotted}" VERSION_LESS "${arg_VERSION_as_dotted}")
|
|
message(FATAL_ERROR
|
|
"Your vcpkg executable is from ${VCPKG_BASE_VERSION} which is older than required by the caller "
|
|
"of vcpkg_minimum_required(VERSION ${arg_VERSION}). "
|
|
"Please re-acquire vcpkg by running bootstrap-vcpkg."
|
|
)
|
|
endif()
|
|
endfunction()
|