Added basic OpenSSL support in CMake scripts (Thanks to Bill Hoffman)

This commit is contained in:
Benoit Neil 2009-04-02 23:12:22 +00:00
parent 168fb3a8d8
commit 9a184e0bb1
3 changed files with 36 additions and 2 deletions

19
CMake/FindOpenSSL.cmake Normal file
View File

@ -0,0 +1,19 @@
# Extension of the standard FindOpenSSL.cmake
# Adds OPENSSL_INCLUDE_DIRS and libeay32
INCLUDE("${CMAKE_ROOT}/Modules/FindOpenSSL.cmake")
# Bill Hoffman told that libeay32 is necessary for him:
FIND_LIBRARY(SSL_LIBEAY NAMES libeay32)
IF(OPENSSL_FOUND)
IF(SSL_LIBEAY)
LIST(APPEND OPENSSL_LIBRARIES ${SSL_LIBEAY})
ELSE()
SET(OPENSSL_FOUND FALSE)
ENDIF()
ENDIF()
IF(OPENSSL_FOUND)
SET(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
ENDIF()

View File

@ -187,8 +187,19 @@ CHECK_LIBRARY_EXISTS_CONCAT("winmm" getch HAVE_LIBWINMM)
OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
MARK_AS_ADVANCED(CMAKE_USE_OPENSSL)
IF(CMAKE_USE_OPENSSL)
CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL)
IF(WIN32)
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(USE_SSLEAY TRUE)
SET(USE_OPENSSL TRUE)
LIST(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} )
ENDIF()
#FIND_LIBRARY(LIBEAY NAMES libeay32)
#LIST(APPEND CURL_LIBS ${LIBEAY} )
ELSE(WIN32)
CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL)
ENDIF(WIN32)
ENDIF(CMAKE_USE_OPENSSL)
# Check for idn

View File

@ -110,6 +110,10 @@ IF(CURL_MALLOC_DEBUG)
)
ENDIF(CURL_MALLOC_DEBUG)
IF(CMAKE_USE_OPENSSL AND OPENSSL_FOUND)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
ENDIF()
IF(CURL_ZLIB AND ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF()