diff options
Diffstat (limited to 'cmake/ssl.cmake')
-rw-r--r-- | cmake/ssl.cmake | 102 |
1 files changed, 19 insertions, 83 deletions
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index fef78600de2..b00250cf367 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -71,6 +71,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL) SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file}) ENDFOREACH() + MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") ENDMACRO() # MYSQL_CHECK_SSL @@ -111,90 +112,24 @@ MACRO (MYSQL_CHECK_SSL) UNSET(OPENSSL_APPLINK_C) UNSET(OPENSSL_APPLINK_C CACHE) ENDIF() - IF (OPENSSL_LIBRARIES) - UNSET(OPENSSL_LIBRARIES) - UNSET(OPENSSL_LIBRARIES CACHE) + IF (OPENSSL_SSL_LIBRARY) + UNSET(OPENSSL_SSL_LIBRARY) + UNSET(OPENSSL_SSL_LIBRARY CACHE) ENDIF() ELSEIF(WITH_SSL STREQUAL "system" OR WITH_SSL STREQUAL "yes" OR WITH_SSL_PATH ) - # First search in WITH_SSL_PATH. - FIND_PATH(OPENSSL_ROOT_DIR - NAMES include/openssl/ssl.h - NO_CMAKE_PATH - NO_CMAKE_ENVIRONMENT_PATH - HINTS ${WITH_SSL_PATH} - ) - # Then search in standard places (if not found above). - FIND_PATH(OPENSSL_ROOT_DIR - NAMES include/openssl/ssl.h - ) - - FIND_PATH(OPENSSL_INCLUDE_DIR - NAMES openssl/ssl.h - HINTS ${OPENSSL_ROOT_DIR}/include - ) - - IF (WIN32) - FIND_FILE(OPENSSL_APPLINK_C - NAMES openssl/applink.c - HINTS ${OPENSSL_ROOT_DIR}/include - ) - MESSAGE(STATUS "OPENSSL_APPLINK_C ${OPENSSL_APPLINK_C}") - ENDIF() - - # On mac this list is <.dylib;.so;.a> - # We prefer static libraries, so we revert it here. - IF (WITH_SSL_PATH) - LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) - ENDIF() - FIND_LIBRARY(OPENSSL_LIBRARIES - NAMES ssl ssleay32 ssleay32MD - HINTS ${OPENSSL_ROOT_DIR}/lib) - FIND_LIBRARY(CRYPTO_LIBRARY - NAMES crypto libeay32 - HINTS ${OPENSSL_ROOT_DIR}/lib) - MARK_AS_ADVANCED(CRYPTO_LIBRARY OPENSSL_LIBRARIES OPENSSL_ROOT_DIR - OPENSSL_INCLUDE_DIR) - IF (WITH_SSL_PATH) - LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) - ENDIF() - - IF (OPENSSL_INCLUDE_DIR) - # Verify version number. Version information looks like: - # #define OPENSSL_VERSION_NUMBER 0x1000103fL - # Encoded as MNNFFPPS: major minor fix patch status - FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" - OPENSSL_VERSION_NUMBER - REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*" - ) - STRING(REGEX REPLACE - "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9][0-9][0-9]).*$" "\\1" - OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}" - ) - MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}") + IF(NOT OPENSSL_ROOT_DIR) + IF(WITH_SSL_PATH) + SET(OPENSSL_ROOT_DIR ${WITH_SSL_PATH}) + ENDIF() ENDIF() - - INCLUDE(CheckSymbolExists) - INCLUDE(CheckCSourceCompiles) - SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) - CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" - HAVE_SHA512_DIGEST_LENGTH) - CHECK_C_SOURCE_COMPILES(" - #include <openssl/dh.h> - int main() - { - DH dh; - return sizeof(dh.version); - }" OLD_OPENSSL_API) - SET(CMAKE_REQUIRED_INCLUDES) - IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES AND - OLD_OPENSSL_API AND - CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) - + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(OPENSSL_LIBRARY ${OPENSSL_SSL_LIBRARY}) SET(SSL_SOURCES "") - SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) + SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET}) ENDIF() @@ -202,10 +137,11 @@ MACRO (MYSQL_CHECK_SSL) SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBDL}) ENDIF() - MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}") - MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}") - MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}") - MESSAGE(STATUS "SSL_LIBRARIES = ${SSL_LIBRARIES}") + MESSAGE_ONCE(OPENSSL_INCLUDE_DIR "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}") + MESSAGE_ONCE(OPENSSL_SSL_LIBRARY "OPENSSL_SSL_LIBRARY = ${OPENSSL_SSL_LIBRARY}") + MESSAGE_ONCE(OPENSSL_CRYPTO_LIBRARY "OPENSSL_CRYPTO_LIBRARY = ${OPENSSL_CRYPTO_LIBRARY}") + MESSAGE_ONCE(OPENSSL_VERSION "OPENSSL_VERSION = ${OPENSSL_VERSION}") + MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) SET(SSL_INTERNAL_INCLUDE_DIRS "") SET(SSL_DEFINES "-DHAVE_OPENSSL") @@ -238,8 +174,8 @@ ENDMACRO() # So we should be linking static versions of the libraries. MACRO (COPY_OPENSSL_DLLS target_name) IF (WIN32 AND WITH_SSL_PATH) - GET_FILENAME_COMPONENT(CRYPTO_NAME "${CRYPTO_LIBRARY}" NAME_WE) - GET_FILENAME_COMPONENT(OPENSSL_NAME "${OPENSSL_LIBRARIES}" NAME_WE) + GET_FILENAME_COMPONENT(CRYPTO_NAME "${OPENSSL_CRYPTO_LIBRARY}" NAME_WE) + GET_FILENAME_COMPONENT(OPENSSL_NAME "${OPENSSL_SSL_LIBRARY}" NAME_WE) FILE(GLOB HAVE_CRYPTO_DLL "${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll") FILE(GLOB HAVE_OPENSSL_DLL "${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll") IF (HAVE_CRYPTO_DLL AND HAVE_OPENSSL_DLL) |