aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_minimum_required.cmake
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2021-07-30 12:57:07 -0700
committerGitHub <noreply@github.com>2021-07-30 12:57:07 -0700
commita5a70c7c3eadcc8a48b5f513b0ec361e40a5aeca (patch)
treec566f37f8dba7c0fa032bb1da97ed0d51a11a91b /scripts/cmake/vcpkg_minimum_required.cmake
parentfa1bbe097b26678e3fd992173b62279c071c422b (diff)
downloadvcpkg-a5a70c7c3eadcc8a48b5f513b0ec361e40a5aeca.tar.gz
vcpkg-a5a70c7c3eadcc8a48b5f513b0ec361e40a5aeca.zip
[vcpkg_minimum_required] fix, add unit tests (#19257)
* fix vcpkg_minimum_required drive-by scripts audit * initial unit tests * finish unit tests
Diffstat (limited to 'scripts/cmake/vcpkg_minimum_required.cmake')
-rw-r--r--scripts/cmake/vcpkg_minimum_required.cmake23
1 files changed, 12 insertions, 11 deletions
diff --git a/scripts/cmake/vcpkg_minimum_required.cmake b/scripts/cmake/vcpkg_minimum_required.cmake
index 44777875e..a8f3a1265 100644
--- a/scripts/cmake/vcpkg_minimum_required.cmake
+++ b/scripts/cmake/vcpkg_minimum_required.cmake
@@ -15,31 +15,32 @@ The date-version to check against.
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."
+ 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}")
+ 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}")
+ if(NOT "${arg_VERSION}" MATCHES "${vcpkg_date_regex}")
message(FATAL_ERROR
- "VERSION parameter to vcpkg_minimum_required was not a valid date. "
- "Comparing with vcpkg tool version ${VCPKG_BASE_VERSION}"
- )
+ "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 vcpkg_VERSION_as_dotted)
+ 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}). "