summaryrefslogtreecommitdiff
path: root/Modules/FindOpenSSL.cmake
diff options
context:
space:
mode:
authorThijs Wenker <me@thoys.nl>2015-10-01 16:41:58 +0200
committerBrad King <brad.king@kitware.com>2015-10-05 11:40:09 -0400
commit821e17785ecd4a329842dc6c5b093eb30cc4f160 (patch)
tree4f77750f637e65983a9cfd0784dfccad3fa4ac2d /Modules/FindOpenSSL.cmake
parentf2791da132a42cb71384065b340ae212679fc336 (diff)
downloadcmake-821e17785ecd4a329842dc6c5b093eb30cc4f160.tar.gz
FindOpenSSL: Add support for static MSVC runtime
Add an OPENSSL_MSVC_STATIC_RT option to switch from the default search for `/MD` libraries to look for `/MT` libraries instead.
Diffstat (limited to 'Modules/FindOpenSSL.cmake')
-rw-r--r--Modules/FindOpenSSL.cmake17
1 files changed, 12 insertions, 5 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index d75e8ab258..a0f4c524b1 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -37,6 +37,7 @@
#
# Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
# Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
+# Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -113,7 +114,7 @@ if(WIN32 AND NOT CYGWIN)
# /MD and /MDd are the standard values - if someone wants to use
# others, the libnames have to change here too
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
- # TODO: handle /MT and static lib
+ # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL)
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
# * MD for dynamic-release
# * MDd for dynamic-debug
@@ -126,6 +127,12 @@ if(WIN32 AND NOT CYGWIN)
# ssleay32MD.lib is identical to ../ssleay32.lib
# enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
+ if (OPENSSL_MSVC_STATIC_RT)
+ set(_OPENSSL_MSVC_RT_MODE "MT")
+ else ()
+ set(_OPENSSL_MSVC_RT_MODE "MD")
+ endif ()
+
if(OPENSSL_USE_STATIC_LIBS)
set(_OPENSSL_PATH_SUFFIXES
"lib"
@@ -142,7 +149,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY_DEBUG
NAMES
- libeay32MDd
+ libeay32${_OPENSSL_MSVC_RT_MODE}d
libeay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
@@ -151,7 +158,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY_RELEASE
NAMES
- libeay32MD
+ libeay32${_OPENSSL_MSVC_RT_MODE}
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
@@ -160,7 +167,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_DEBUG
NAMES
- ssleay32MDd
+ ssleay32${_OPENSSL_MSVC_RT_MODE}d
ssleay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
@@ -169,7 +176,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_RELEASE
NAMES
- ssleay32MD
+ ssleay32${_OPENSSL_MSVC_RT_MODE}
ssleay32
ssl
${_OPENSSL_ROOT_HINTS_AND_PATHS}