From 4b793ad1965579836a05a5d55b6ff30849909928 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 23 Jul 2012 20:34:48 +0200 Subject: FindOpenSSL: find cross-compiled OpenSSL from MinGW (#13431) Suggested-by: Dominik Schmidt --- Modules/FindOpenSSL.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index d1fc2d2..c19667d 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -134,9 +134,15 @@ IF(WIN32 AND NOT CYGWIN) MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) ELSEIF(MINGW) # same player, for MingW + SET(LIB_EAY_NAMES libeay32) + SET(SSL_EAY_NAMES ssleay32) + IF(CMAKE_CROSS_COMPILING) + LIST(APPEND LIB_EAY_NAMES crypto) + LIST(APPEND SSL_EAY_NAMES ssl) + ENDIF() FIND_LIBRARY(LIB_EAY NAMES - libeay32 + ${LIB_EAY_NAMES} ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -145,7 +151,7 @@ IF(WIN32 AND NOT CYGWIN) FIND_LIBRARY(SSL_EAY NAMES - ssleay32 + ${SSL_EAY_NAMES} ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -154,6 +160,8 @@ IF(WIN32 AND NOT CYGWIN) MARK_AS_ADVANCED(SSL_EAY LIB_EAY) set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + unset(LIB_EAY_NAMES) + unset(SSL_EAY_NAMES) ELSE(MSVC) # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: FIND_LIBRARY(LIB_EAY -- cgit v0.12 From 7464519304636703e2b08a1b89f2d9069d8eb096 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 23 Jul 2012 21:00:40 +0200 Subject: FindOpenSSL: use SelectLibraryConfigurations --- Modules/FindOpenSSL.cmake | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index c19667d..bd46c9f 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -79,7 +79,6 @@ IF(WIN32 AND NOT CYGWIN) FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd - libeay32 ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -101,8 +100,6 @@ IF(WIN32 AND NOT CYGWIN) FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd - ssleay32 - ssl ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -122,16 +119,11 @@ IF(WIN32 AND NOT CYGWIN) "lib/VC" ) - if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( OPENSSL_LIBRARIES - optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG} - optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG} - ) - else() - set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} ) - endif() - MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE) - MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(LIB_EAY) + select_library_configurations(SSL_EAY) + + set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) ELSEIF(MINGW) # same player, for MingW SET(LIB_EAY_NAMES libeay32) -- cgit v0.12 From c78a7d11dd1eda50ce69566cc74311dde218839c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 23 Jul 2012 21:02:43 +0200 Subject: FindOpenSSL: let CMake handle environment variable HINTS This will automatically make sure the paths will get recoded to proper separators on Windows --- Modules/FindOpenSSL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index bd46c9f..652ce05 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -31,10 +31,10 @@ endif (UNIX) # http://www.slproweb.com/products/Win32OpenSSL.html SET(_OPENSSL_ROOT_HINTS - $ENV{OPENSSL_ROOT_DIR} ${OPENSSL_ROOT_DIR} "[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 ) SET(_OPENSSL_ROOT_PATHS "$ENV{PROGRAMFILES}/OpenSSL" -- cgit v0.12 From fc798ed64fe4c67881653805720b846a0489d1b9 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 29 Jul 2012 17:02:00 +0200 Subject: FindOpenSSL: cleanup path hints -only use Windows-specific paths on Windows -recode the contents of $ENV{PROGRAMFILES} to be a valid CMake path before using it --- Modules/FindOpenSSL.cmake | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 652ce05..fa5cfba 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -29,25 +29,34 @@ if (UNIX) pkg_check_modules(_OPENSSL QUIET openssl) endif (UNIX) -# http://www.slproweb.com/products/Win32OpenSSL.html -SET(_OPENSSL_ROOT_HINTS - ${OPENSSL_ROOT_DIR} - "[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 - ) -SET(_OPENSSL_ROOT_PATHS - "$ENV{PROGRAMFILES}/OpenSSL" - "$ENV{PROGRAMFILES}/OpenSSL-Win32" - "$ENV{PROGRAMFILES}/OpenSSL-Win64" - "C:/OpenSSL/" - "C:/OpenSSL-Win32/" - "C:/OpenSSL-Win64/" - ) -SET(_OPENSSL_ROOT_HINTS_AND_PATHS - HINTS ${_OPENSSL_ROOT_HINTS} - PATHS ${_OPENSSL_ROOT_PATHS} - ) +IF (WIN32) + # http://www.slproweb.com/products/Win32OpenSSL.html + SET(_OPENSSL_ROOT_HINTS + ${OPENSSL_ROOT_DIR} + "[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 + ) + FILE(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) + SET(_OPENSSL_ROOT_PATHS + "${_programfiles}/OpenSSL" + "${_programfiles}/OpenSSL-Win32" + "${_programfiles}/OpenSSL-Win64" + "C:/OpenSSL/" + "C:/OpenSSL-Win32/" + "C:/OpenSSL-Win64/" + ) + UNSET(_programfiles) + SET(_OPENSSL_ROOT_HINTS_AND_PATHS + HINTS ${_OPENSSL_ROOT_HINTS} + PATHS ${_OPENSSL_ROOT_PATHS} + ) +ELSE () + SET(_OPENSSL_ROOT_HINTS + ${OPENSSL_ROOT_DIR} + ENV OPENSSL_ROOT_DIR + ) +ENDIF () FIND_PATH(OPENSSL_INCLUDE_DIR NAMES -- cgit v0.12 From 3cfb68d93e66be8ae9f46757d314c61fe59bc900 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 29 Jul 2012 17:03:36 +0200 Subject: FindOpenSSL: remove leftover comment --- Modules/FindOpenSSL.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index fa5cfba..6642915 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -69,7 +69,6 @@ FIND_PATH(OPENSSL_INCLUDE_DIR ) IF(WIN32 AND NOT CYGWIN) - # MINGW should go here too IF(MSVC) # /MD and /MDd are the standard values - if someone wants to use # others, the libnames have to change here too -- cgit v0.12