diff options
author | Ma Br <ayorflpd@10mail.org> | 2020-12-17 21:08:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-21 18:34:42 (GMT) |
commit | a6e03b2e6f972fc28ecae8d7403f0f929bfe1895 (patch) | |
tree | 457e1498ce32a33d5aa19572734c1461af87a12a /Modules/FindOpenSSL.cmake | |
parent | 6d7621baeaaf4e19322480484b33f9ca95e6c75e (diff) | |
download | CMake-a6e03b2e6f972fc28ecae8d7403f0f929bfe1895.zip CMake-a6e03b2e6f972fc28ecae8d7403f0f929bfe1895.tar.gz CMake-a6e03b2e6f972fc28ecae8d7403f0f929bfe1895.tar.bz2 |
FindOpenSSL: Distinguish 32-bit and 64-bit search paths on Windows
Fixes: #21611
Diffstat (limited to 'Modules/FindOpenSSL.cmake')
-rw-r--r-- | Modules/FindOpenSSL.cmake | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 03b699b..d574790 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} |