From 12b7546ce498a81dff4a58760185cef238486898 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Wed, 6 May 2020 12:44:51 -0400 Subject: [PATCH] python: Handle REQUIRED arguments for FindPythonModule --- cmake/FindPythonModule.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/FindPythonModule.cmake b/cmake/FindPythonModule.cmake index e248241399..4f9cf29f57 100644 --- a/cmake/FindPythonModule.cmake +++ b/cmake/FindPythonModule.cmake @@ -121,12 +121,19 @@ set( PythonModule_${module_NAME}_PATH endif() include(FindPackageHandleStandardArgs) - set(FPHSA_NAME_MISMATCHED TRUE) + set(CMAKE_FIND_PACKAGE_NAME PythonModule_${module_NAME}) + foreach(VAR IN ITEMS REQUIRED QUIETLY VERSION COMPONENTS) + if(DEFINED PythonModule_FIND_${VAR}) + set(PythonModule_${module_NAME}_FIND_${VAR} "${PythonModule_FIND_${VAR}}") + else() + unset(PythonModule_${module_NAME}_FIND_${VAR}) + endif() + endforeach() + find_package_handle_standard_args(PythonModule_${module_NAME} FOUND_VAR PythonModule_${module_NAME}_FOUND REQUIRED_VARS ${required_vars} ) - unset(FPHSA_NAME_MISMATCHED) endif() if(PythonModule_${module_NAME}_FOUND AND