1 # - Try to find the OpenSSL encryption library
\r
2 # Once done this will define
\r
4 # OPENSSL_FOUND - system has the OpenSSL library
\r
5 # OPENSSL_INCLUDE_DIR - the OpenSSL include directory
\r
6 # OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
\r
8 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
\r
10 # Redistribution and use is allowed according to the terms of the BSD license.
\r
11 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
\r
14 IF(OPENSSL_LIBRARIES)
\r
15 SET(OpenSSL_FIND_QUIETLY TRUE)
\r
16 ENDIF(OPENSSL_LIBRARIES)
\r
18 IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
\r
20 ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
\r
22 FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h )
\r
25 # /MD and /MDd are the standard values - if somone wants to use
\r
26 # others, the libnames have to change here too
\r
27 # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
\r
29 FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32)
\r
30 FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32)
\r
33 IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
\r
34 SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG})
\r
35 ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
\r
36 MESSAGE(FATAL_ERROR "Could not find the debug and release version of openssl")
\r
37 ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
\r
39 STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
\r
40 IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
\r
41 SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG})
\r
42 ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
\r
43 SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE})
\r
44 ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
\r
46 MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
\r
47 ELSE(WIN32 AND MSVC)
\r
49 FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD )
\r
51 ENDIF(WIN32 AND MSVC)
\r
53 IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
\r
54 SET(OPENSSL_FOUND TRUE)
\r
55 ELSE(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
\r
56 SET(OPENSSL_FOUND FALSE)
\r
57 ENDIF (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
\r
60 IF (NOT OpenSSL_FIND_QUIETLY)
\r
61 MESSAGE(STATUS "Found OpenSSL: ${OPENSSL_LIBRARIES}")
\r
62 ENDIF (NOT OpenSSL_FIND_QUIETLY)
\r
63 ELSE (OPENSSL_FOUND)
\r
64 IF (OpenSSL_FIND_REQUIRED)
\r
65 MESSAGE(FATAL_ERROR "Could NOT find OpenSSL")
\r
66 ENDIF (OpenSSL_FIND_REQUIRED)
\r
67 ENDIF (OPENSSL_FOUND)
\r
69 MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
\r