From 3104bf3710ba5c875cebb22af103158447d94f3c Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Wed, 8 Jan 2020 20:13:34 -0700 Subject: [PATCH] CMake: Fix issue with HAVE_X safety checks falsely failing --- cmake/macros/PackageConfig.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/macros/PackageConfig.cmake b/cmake/macros/PackageConfig.cmake index 8039039e1b..7ee5ca7f39 100644 --- a/cmake/macros/PackageConfig.cmake +++ b/cmake/macros/PackageConfig.cmake @@ -149,7 +149,8 @@ function(package_option name) endif() # If it was set by the user but not found, display an error. - if(HAVE_${name} AND NOT ${found_as}_FOUND) + string(TOUPPER "${found_as}" FOUND_AS) + if(HAVE_${name} AND NOT ${found_as}_FOUND AND NOT ${FOUND_AS}_FOUND) message(SEND_ERROR "NOT FOUND: ${name}. Disable HAVE_${name} to continue.") endif() @@ -209,8 +210,6 @@ function(package_option name) endforeach(implib) if(use_variables) - string(TOUPPER "${found_as}" FOUND_AS) - if(DEFINED ${found_as}_INCLUDE_DIRS) set(includes ${${found_as}_INCLUDE_DIRS}) elseif(DEFINED ${found_as}_INCLUDE_DIR)