aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJakub Zakrzewski <jzakrzewski@e2ebridge.com>2014-08-21 13:15:59 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-10-09 13:48:30 +0200
commitcb2438ae52ede1888d1aa512bbb169168f96c284 (patch)
tree1581d9ebafe7b8f31224abdba2482f7b5f1e5cd0 /CMakeLists.txt
parent51f6702fe17154921a74aff841d19b020ee36796 (diff)
downloadgnurl-cb2438ae52ede1888d1aa512bbb169168f96c284.tar.gz
gnurl-cb2438ae52ede1888d1aa512bbb169168f96c284.tar.bz2
gnurl-cb2438ae52ede1888d1aa512bbb169168f96c284.zip
Cmake: Check for OpenSSL before OpenLDAP.
OpenLDAP might have been build with OpenSSL. Checking for OpenLDAP first may result in undefined symbols. Of course, the found OpenSSL libraries must also be linked whenever OpenLDAP is.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt63
1 files changed, 32 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 845c330fe..694c3bc2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,6 +224,36 @@ if(WIN32)
check_library_exists_concat("winmm" getch HAVE_LIBWINMM)
endif()
+option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
+mark_as_advanced(CMAKE_USE_OPENSSL)
+
+set(USE_SSLEAY OFF)
+set(USE_OPENSSL OFF)
+set(HAVE_LIBCRYPTO OFF)
+set(HAVE_LIBSSL OFF)
+
+if(CMAKE_USE_OPENSSL)
+ find_package(OpenSSL)
+ if(OPENSSL_FOUND)
+ list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
+ set(USE_SSLEAY ON)
+ set(USE_OPENSSL ON)
+ set(HAVE_LIBCRYPTO ON)
+ set(HAVE_LIBSSL ON)
+ include_directories(${OPENSSL_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+ check_include_file_concat("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
+ check_include_file_concat("openssl/engine.h" HAVE_OPENSSL_ENGINE_H)
+ check_include_file_concat("openssl/err.h" HAVE_OPENSSL_ERR_H)
+ check_include_file_concat("openssl/pem.h" HAVE_OPENSSL_PEM_H)
+ check_include_file_concat("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H)
+ check_include_file_concat("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
+ check_include_file_concat("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
+ check_include_file_concat("openssl/x509.h" HAVE_OPENSSL_X509_H)
+ check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H)
+ endif()
+endif()
+
if(NOT CURL_DISABLE_LDAP)
if(WIN32)
@@ -248,6 +278,7 @@ if(NOT CURL_DISABLE_LDAP)
# Now that we know, we're not using windows LDAP...
if(NOT CURL_LDAP_WIN)
# Check for LDAP
+ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
check_library_exists_concat(${CMAKE_LDAP_LIB} ldap_init HAVE_LIBLDAP)
check_library_exists_concat(${CMAKE_LBER_LIB} ber_init HAVE_LIBLBER)
else()
@@ -302,7 +333,7 @@ if(NOT CURL_DISABLE_LDAP)
}"
)
set(CMAKE_REQUIRED_DEFINITIONS "-DLDAP_DEPRECATED=1" "-DWIN32_LEAN_AND_MEAN")
- set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_LDAP_LIB})
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LDAP_LIB})
if(HAVE_LIBLBER)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LBER_LIB})
endif()
@@ -353,36 +384,6 @@ if(CURL_ZLIB)
endif()
endif()
-option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
-mark_as_advanced(CMAKE_USE_OPENSSL)
-
-set(USE_SSLEAY OFF)
-set(USE_OPENSSL OFF)
-set(HAVE_LIBCRYPTO OFF)
-set(HAVE_LIBSSL OFF)
-
-if(CMAKE_USE_OPENSSL)
- find_package(OpenSSL)
- if(OPENSSL_FOUND)
- list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
- set(USE_SSLEAY ON)
- set(USE_OPENSSL ON)
- set(HAVE_LIBCRYPTO ON)
- set(HAVE_LIBSSL ON)
- include_directories(${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- check_include_file_concat("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
- check_include_file_concat("openssl/engine.h" HAVE_OPENSSL_ENGINE_H)
- check_include_file_concat("openssl/err.h" HAVE_OPENSSL_ERR_H)
- check_include_file_concat("openssl/pem.h" HAVE_OPENSSL_PEM_H)
- check_include_file_concat("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H)
- check_include_file_concat("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
- check_include_file_concat("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
- check_include_file_concat("openssl/x509.h" HAVE_OPENSSL_X509_H)
- check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H)
- endif(OPENSSL_FOUND)
-endif(CMAKE_USE_OPENSSL)
-
#libSSH2
option(CMAKE_USE_LIBSSH2 "Use libSSH2" ON)
mark_as_advanced(CMAKE_USE_LIBSSH2)