diff options
author | FeRD (Frank Dana) <ferdnyc@gmail.com> | 2020-01-23 01:49:05 (GMT) |
---|---|---|
committer | FeRD (Frank Dana) <ferdnyc@gmail.com> | 2020-01-24 01:26:05 (GMT) |
commit | 31144f85af7ff72c177b4c5f27a593fe931cce78 (patch) | |
tree | 4f867db9ec0e9522241284b51b4daa8d1b9ad0ec /Modules/FindPackageHandleStandardArgs.cmake | |
parent | 593d0f3a578a51775d6402064ec53dce42b4d82c (diff) | |
download | CMake-31144f85af7ff72c177b4c5f27a593fe931cce78.zip CMake-31144f85af7ff72c177b4c5f27a593fe931cce78.tar.gz CMake-31144f85af7ff72c177b4c5f27a593fe931cce78.tar.bz2 |
FPHSA: Check _FOUND var name with STREQUAL
Using MATCHES "^${_Name}_FOUND$" limits the name of the found variable,
since it can't contain any regular expression special-chars (period,
plus sign, etc.)
Diffstat (limited to 'Modules/FindPackageHandleStandardArgs.cmake')
-rw-r--r-- | Modules/FindPackageHandleStandardArgs.cmake | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index a7c3eae..a078049 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -289,10 +289,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) string(TOLOWER ${_NAME} _NAME_LOWER) if(FPHSA_FOUND_VAR) - if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND) + set(_FOUND_VAR_MIXED ${_NAME}_FOUND) + if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER) set(_FOUND_VAR ${FPHSA_FOUND_VAR}) else() - message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.") endif() else() set(_FOUND_VAR ${_NAME_UPPER}_FOUND) |