summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Neil <suky0001@free.fr>2009-04-02 23:12:22 +0000
committerBenoit Neil <suky0001@free.fr>2009-04-02 23:12:22 +0000
commit9a184e0bb149631ee5e080aecb609eef2e7869f1 (patch)
tree39663609e48beb0a7bd1a1daa8e5b5bd0a56c991
parent168fb3a8d89bd83c926f3fa2314e064294ebff0b (diff)
downloadcurl-9a184e0bb149631ee5e080aecb609eef2e7869f1.tar.gz
Added basic OpenSSL support in CMake scripts (Thanks to Bill Hoffman)
-rw-r--r--CMake/FindOpenSSL.cmake19
-rw-r--r--CMakeLists.txt15
-rw-r--r--lib/CMakeLists.txt4
3 files changed, 36 insertions, 2 deletions
diff --git a/CMake/FindOpenSSL.cmake b/CMake/FindOpenSSL.cmake
new file mode 100644
index 000000000..6eea6ff24
--- /dev/null
+++ b/CMake/FindOpenSSL.cmake
@@ -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()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 158215d2a..a3d2db21d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 655c2ffb2..a1dbfbcf8 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -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()