CMake: Fix error flood if OpenSSL is not present

Fixes #1013
This commit is contained in:
rdb 2020-11-17 22:25:39 +01:00
parent 0cd4160a71
commit ac089658f3

View File

@ -145,6 +145,8 @@ function(package_option name)
endif()
endif()
option("HAVE_${name}" "${cache_string}" "${default}")
# If it was set by the user but not found, display an error.
string(TOUPPER "${found_as}" FOUND_AS)
if(HAVE_${name} AND NOT ${found_as}_FOUND AND NOT ${FOUND_AS}_FOUND)
@ -180,9 +182,7 @@ function(package_option name)
"$<TARGET_PROPERTY:PKG::${name},INTERFACE_INCLUDE_DIRECTORIES>")
endif()
# Create the option, and if it actually is enabled, populate the INTERFACE
# library created above
option("HAVE_${name}" "${cache_string}" "${default}")
# If the option actually is enabled, populate the INTERFACE library created above
if(HAVE_${name})
set(use_variables ON)