summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindOpenSSL.cmake131
1 files changed, 93 insertions, 38 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 4d0e67f..8f2c019 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -33,27 +33,32 @@ 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]"
)
SET(_OPENSSL_ROOT_PATHS
+ "$ENV{PROGRAMFILES}/OpenSSL"
+ "$ENV{PROGRAMFILES}/OpenSSL-Win32"
+ "$ENV{PROGRAMFILES}/OpenSSL-Win64"
"C:/OpenSSL/"
+ "C:/OpenSSL-Win32/"
+ "C:/OpenSSL-Win64/"
)
-FIND_PATH(OPENSSL_ROOT_DIR
- NAMES include/openssl/ssl.h
+SET(_OPENSSL_ROOT_HINTS_AND_PATHS
HINTS ${_OPENSSL_ROOT_HINTS}
PATHS ${_OPENSSL_ROOT_PATHS}
- ENV OPENSSL_ROOT_DIR
-)
-MARK_AS_ADVANCED(OPENSSL_ROOT_DIR)
+ )
-# Re-use the previous path:
FIND_PATH(OPENSSL_INCLUDE_DIR
NAMES
openssl/ssl.h
- PATHS
+ HINTS
${_OPENSSL_INCLUDEDIR}
- ${OPENSSL_ROOT_DIR}/include
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ include
)
IF(WIN32 AND NOT CYGWIN)
@@ -73,22 +78,52 @@ IF(WIN32 AND NOT CYGWIN)
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
# libeay32MD.lib is identical to ../libeay32.lib, and
# ssleay32MD.lib is identical to ../ssleay32.lib
- FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32
- PATHS ${OPENSSL_ROOT_DIR}
- PATH_SUFFIXES "lib" "VC" "lib/VC"
- )
- FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32
- PATHS ${OPENSSL_ROOT_DIR}
- PATH_SUFFIXES "lib" "VC" "lib/VC"
- )
- FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssleay32 ssl
- PATHS ${OPENSSL_ROOT_DIR}
- PATH_SUFFIXES "lib" "VC" "lib/VC"
- )
- FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssleay32 ssl
- PATHS ${OPENSSL_ROOT_DIR}
- PATH_SUFFIXES "lib" "VC" "lib/VC"
- )
+ FIND_LIBRARY(LIB_EAY_DEBUG
+ NAMES
+ libeay32MDd
+ libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(LIB_EAY_RELEASE
+ NAMES
+ libeay32MD
+ libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(SSL_EAY_DEBUG
+ NAMES
+ ssleay32MDd
+ ssleay32
+ ssl
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
+ FIND_LIBRARY(SSL_EAY_RELEASE
+ NAMES
+ ssleay32MD
+ ssleay32
+ ssl
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "VC"
+ "lib/VC"
+ )
+
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
set( OPENSSL_LIBRARIES
optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG}
@@ -101,14 +136,24 @@ IF(WIN32 AND NOT CYGWIN)
MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
ELSEIF(MINGW)
# same player, for MingW
- FIND_LIBRARY(LIB_EAY NAMES libeay32
- PATHS ${OPENSSL_ROOT_DIR}
- PATH_SUFFIXES "lib" "VC" "lib/MinGW"
- )
- FIND_LIBRARY(SSL_EAY NAMES ssleay32
- PATHS ${OPENSSL_ROOT_DIR}
- PATH_SUFFIXES "lib" "VC" "lib/MinGW"
- )
+ FIND_LIBRARY(LIB_EAY
+ NAMES
+ libeay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "lib/MinGW"
+ )
+
+ FIND_LIBRARY(SSL_EAY
+ NAMES
+ ssleay32
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ "lib"
+ "lib/MinGW"
+ )
+
MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
ELSE(MSVC)
@@ -116,17 +161,21 @@ IF(WIN32 AND NOT CYGWIN)
FIND_LIBRARY(LIB_EAY
NAMES
libeay32
- PATHS
+ HINTS
${_OPENSSL_LIBDIR}
- ${OPENSSL_ROOT_DIR}/lib
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
)
FIND_LIBRARY(SSL_EAY
NAMES
ssleay32
- PATHS
+ HINTS
${_OPENSSL_LIBDIR}
- ${OPENSSL_ROOT_DIR}/lib
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
)
MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
@@ -139,15 +188,21 @@ ELSE(WIN32 AND NOT CYGWIN)
ssl
ssleay32
ssleay32MD
- PATHS
+ HINTS
${_OPENSSL_LIBDIR}
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
)
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES
NAMES
crypto
- PATHS
+ HINTS
${_OPENSSL_LIBDIR}
+ ${_OPENSSL_ROOT_HINTS_AND_PATHS}
+ PATH_SUFFIXES
+ lib
)
MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES)