summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <richard@levitte.org>2023-05-17 09:40:42 (GMT)
committerRichard Levitte <richard@levitte.org>2023-05-19 03:59:57 (GMT)
commit5cc8a69867ac42333a656607d90059a6db823abd (patch)
treed0f429e311e581304e7f4f91ea2a9939cca824d2
parent0383bb7ffaf4f8c7ec51772304be5883748b0a23 (diff)
downloadCMake-5cc8a69867ac42333a656607d90059a6db823abd.zip
CMake-5cc8a69867ac42333a656607d90059a6db823abd.tar.gz
CMake-5cc8a69867ac42333a656607d90059a6db823abd.tar.bz2
FindOpenSSL: Trust the user's OPENSSL_ROOT_DIR
When the user has specified the OpenSSL installation root directory, through the variable OPENSSL_ROOT_DIR or the environment variable with the same name, trust it, don't try to find OpenSSL anywhere else. Fixes: #18352
-rw-r--r--Modules/FindOpenSSL.cmake18
1 files changed, 8 insertions, 10 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 45dc9ac..fd6886f 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -230,13 +230,15 @@ else()
set(_OPENSSL_FIND_PATH_SUFFIX "include")
endif()
-if (MSVC)
+if ((DEFINED OPENSSL_ROOT_DIR) OR (DEFINED ENV{OPENSSL_ROOT_DIR}))
+ set(_OPENSSL_ROOT_HINTS HINTS ${OPENSSL_ROOT_DIR} ENV OPENSSL_ROOT_DIR)
+ set(_OPENSSL_ROOT_PATHS NO_DEFAULT_PATH)
+elseif (MSVC)
# http://www.slproweb.com/products/Win32OpenSSL.html
set(_OPENSSL_ROOT_HINTS
- ${OPENSSL_ROOT_DIR}
+ HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
- ENV OPENSSL_ROOT_DIR
)
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
@@ -255,6 +257,7 @@ if (MSVC)
endif()
set(_OPENSSL_ROOT_PATHS
+ PATHS
"${_programfiles}/OpenSSL"
"${_programfiles}/OpenSSL-${_arch}"
"C:/OpenSSL/"
@@ -262,16 +265,11 @@ if (MSVC)
)
unset(_programfiles)
unset(_arch)
-else ()
- set(_OPENSSL_ROOT_HINTS
- ${OPENSSL_ROOT_DIR}
- ENV OPENSSL_ROOT_DIR
- )
endif ()
set(_OPENSSL_ROOT_HINTS_AND_PATHS
- HINTS ${_OPENSSL_ROOT_HINTS}
- PATHS ${_OPENSSL_ROOT_PATHS}
+ ${_OPENSSL_ROOT_HINTS}
+ ${_OPENSSL_ROOT_PATHS}
)
find_path(OPENSSL_INCLUDE_DIR