summaryrefslogtreecommitdiff
path: root/Modules/FindOpenSSL.cmake
diff options
context:
space:
mode:
authorMa Br <ayorflpd@10mail.org>2020-12-17 16:08:09 -0500
committerBrad King <brad.king@kitware.com>2020-12-21 13:34:42 -0500
commita6e03b2e6f972fc28ecae8d7403f0f929bfe1895 (patch)
tree457e1498ce32a33d5aa19572734c1461af87a12a /Modules/FindOpenSSL.cmake
parent6d7621baeaaf4e19322480484b33f9ca95e6c75e (diff)
downloadcmake-a6e03b2e6f972fc28ecae8d7403f0f929bfe1895.tar.gz
FindOpenSSL: Distinguish 32-bit and 64-bit search paths on Windows
Fixes: #21611
Diffstat (limited to 'Modules/FindOpenSSL.cmake')
-rw-r--r--Modules/FindOpenSSL.cmake24
1 files changed, 19 insertions, 5 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 03b699b2e0..d574790308 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -141,16 +141,30 @@ if (WIN32)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
ENV OPENSSL_ROOT_DIR
)
- file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
+
+ if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ set(_arch "Win64")
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
+ else()
+ set(_arch "Win32")
+ set(_progfiles_x86 "ProgramFiles(x86)")
+ if(NOT "$ENV{${_progfiles_x86}}" STREQUAL "")
+ # under windows 64 bit machine
+ file(TO_CMAKE_PATH "$ENV{${_progfiles_x86}}" _programfiles)
+ else()
+ # under windows 32 bit machine
+ file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _programfiles)
+ endif()
+ endif()
+
set(_OPENSSL_ROOT_PATHS
"${_programfiles}/OpenSSL"
- "${_programfiles}/OpenSSL-Win32"
- "${_programfiles}/OpenSSL-Win64"
+ "${_programfiles}/OpenSSL-${_arch}"
"C:/OpenSSL/"
- "C:/OpenSSL-Win32/"
- "C:/OpenSSL-Win64/"
+ "C:/OpenSSL-${_arch}/"
)
unset(_programfiles)
+ unset(_arch)
else ()
set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}