Since OpenSSL 1.1.0, Windows binaries are libcrypto and libssl instead of the old names libeay32 and ssleay32. When using MSVC, FindOpenSSL was searching for the old lib names only so this add the new names to be able to find OpenSSL 1.1.0 libraries.
For example, the files in lib directory of OpenSSL 1.1.0 Win64 : - libcrypto.lib - libssl.lib - VC/libcrypto64MD.lib - VC/libcrypto64MDd.lib - VC/libcrypto64MT.lib - VC/libcrypto64MTd.lib - VC/libssl64MD.lib - VC/libssl64MDd.lib - VC/libssl64MT.lib - VC/libssl64MTd.lib 32 bits OpenSSL has the same file with "32" instead of "64" for files in VC directory. MinGW still works and use lib/libcrypto.lib and lib/libssl.lib. --- Modules/FindOpenSSL.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 10b62ff..ba29a80 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -133,6 +133,13 @@ if(WIN32 AND NOT CYGWIN) set(_OPENSSL_MSVC_RT_MODE "MD") endif () + # Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib + if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" ) + set(_OPENSSL_MSVC_ARCH_SUFFIX "64") + else() + set(_OPENSSL_MSVC_ARCH_SUFFIX "32") + endif() + if(OPENSSL_USE_STATIC_LIBS) set(_OPENSSL_PATH_SUFFIXES "lib" @@ -150,7 +157,9 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_DEBUG NAMES libeay32${_OPENSSL_MSVC_RT_MODE}d + libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d libeay32d + libcryptod NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -160,7 +169,9 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_RELEASE NAMES libeay32${_OPENSSL_MSVC_RT_MODE} + libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} libeay32 + libcrypto NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -170,7 +181,9 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_DEBUG NAMES ssleay32${_OPENSSL_MSVC_RT_MODE}d + libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d ssleay32d + libssld NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -180,8 +193,10 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_RELEASE NAMES ssleay32${_OPENSSL_MSVC_RT_MODE} + libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} ssleay32 ssl + libssl NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES -- 2.7.4.windows.1 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers