1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Merge topic 'FPHSA-usable-outside-find_package'

14ecf9c2f6 FPHSA: ensure it can be used outside 'find_package'

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5539
This commit is contained in:
Marc Chevrier
2020-11-28 14:02:43 +00:00
committed by Kitware Robot

View File

@@ -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")