diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-11-25 15:36:12 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-11-25 15:36:12 (GMT) |
commit | 14ecf9c2f6edfae4033d9311f79d79d0d07fc1cf (patch) | |
tree | 82b9014fb2b5812ab4e69d9c36cb5dcee071d524 /Modules | |
parent | b4c994f69c6e62ab95a5746db237d0237bc87bc1 (diff) | |
download | CMake-14ecf9c2f6edfae4033d9311f79d79d0d07fc1cf.zip CMake-14ecf9c2f6edfae4033d9311f79d79d0d07fc1cf.tar.gz CMake-14ecf9c2f6edfae4033d9311f79d79d0d07fc1cf.tar.bz2 |
FPHSA: ensure it can be used outside 'find_package'
Fixes: #21505
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindPackageHandleStandardArgs.cmake | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 7af0171..7e17277 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -275,8 +275,10 @@ function(FIND_PACKAGE_CHECK_VERSION version result) unset (${FPCV_RESULT_MESSAGE_VARIABLE} PARENT_SCOPE) endif() - if (CMAKE_FIND_PACKAGE_NAME) - set (package ${CMAKE_FIND_PACKAGE_NAME}) + if (_CMAKE_FPHSA_PACKAGE_NAME) + set (package "${_CMAKE_FPHSA_PACKAGE_NAME}") + elseif (CMAKE_FIND_PACKAGE_NAME) + set (package "${CMAKE_FIND_PACKAGE_NAME}") else() message (FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'") endif() @@ -436,6 +438,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) "will be used.") endif() + # to propagate package name to FIND_PACKAGE_CHECK_VERSION + set(_CMAKE_FPHSA_PACKAGE_NAME "${_NAME}") + # now that we collected all arguments, process them if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") |