summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSergei Nikulov <sergey.nikulov@gmail.com>2016-06-14 17:11:48 +0300
committerJay Satiro <raysatiro@yahoo.com>2016-06-15 14:09:38 -0400
commitb70ca5281d93b621dee700c74740b2621d1e30b4 (patch)
tree1aecac61f95435f4bfc354ef5d466d78aa820eaa /CMakeLists.txt
parentf77dfbc5fbb7a20f8d3ef918df35b68c0b60f1e9 (diff)
downloadcurl-b70ca5281d93b621dee700c74740b2621d1e30b4.tar.gz
cmake: Fix build with winldap
Bug: https://github.com/curl/curl/pull/874 Reported-by: Sergei Nikulov
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt127
1 files changed, 63 insertions, 64 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e6c42e8e..630e4a553 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -330,11 +330,10 @@ if(CMAKE_USE_OPENSSL)
endif()
if(NOT CURL_DISABLE_LDAP)
-
if(WIN32)
option(USE_WIN32_LDAP "Use Windows LDAP implementation" ON)
if(USE_WIN32_LDAP)
- check_library_exists("wldap32" cldap_open "" HAVE_WLDAP32)
+ check_library_exists_concat("wldap32" cldap_open HAVE_WLDAP32)
if(NOT HAVE_WLDAP32)
set(USE_WIN32_LDAP OFF)
endif()
@@ -349,78 +348,78 @@ if(NOT CURL_DISABLE_LDAP)
if(CMAKE_USE_OPENLDAP AND USE_WIN32_LDAP)
message(FATAL_ERROR "Cannot use USE_WIN32_LDAP and CMAKE_USE_OPENLDAP at the same time")
endif()
-
+
# Now that we know, we're not using windows LDAP...
- if(NOT USE_WIN32_LDAP)
+ if(USE_WIN32_LDAP)
+ check_include_file_concat("winldap.h" HAVE_WINLDAP_H)
+ check_include_file_concat("winber.h" HAVE_WINBER_H)
+ else()
# 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()
- check_include_file_concat("winldap.h" HAVE_WINLDAP_H)
- check_include_file_concat("winber.h" HAVE_WINBER_H)
- endif()
-
- set(CMAKE_REQUIRED_INCLUDES_BAK ${CMAKE_REQUIRED_INCLUDES})
- set(CMAKE_LDAP_INCLUDE_DIR "" CACHE STRING "Path to LDAP include directory")
- if(CMAKE_LDAP_INCLUDE_DIR)
- list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_LDAP_INCLUDE_DIR})
- endif()
- check_include_file_concat("ldap.h" HAVE_LDAP_H)
- check_include_file_concat("lber.h" HAVE_LBER_H)
-
- if(NOT HAVE_LDAP_H)
- message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
- set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
- set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used
- elseif(NOT HAVE_LIBLDAP)
- message(STATUS "LDAP library '${CMAKE_LDAP_LIB}' not found CURL_DISABLE_LDAP set ON")
- set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
- set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used
- else()
- if(CMAKE_USE_OPENLDAP)
- set(USE_OPENLDAP ON)
- endif()
+
+ set(CMAKE_REQUIRED_INCLUDES_BAK ${CMAKE_REQUIRED_INCLUDES})
+ set(CMAKE_LDAP_INCLUDE_DIR "" CACHE STRING "Path to LDAP include directory")
if(CMAKE_LDAP_INCLUDE_DIR)
- include_directories(${CMAKE_LDAP_INCLUDE_DIR})
- endif()
- set(NEED_LBER_H ON)
- set(_HEADER_LIST)
- if(HAVE_WINDOWS_H)
- list(APPEND _HEADER_LIST "windows.h")
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_LDAP_INCLUDE_DIR})
endif()
- if(HAVE_SYS_TYPES_H)
- list(APPEND _HEADER_LIST "sys/types.h")
- endif()
- list(APPEND _HEADER_LIST "ldap.h")
+ check_include_file_concat("ldap.h" HAVE_LDAP_H)
+ check_include_file_concat("lber.h" HAVE_LBER_H)
+
+ if(NOT HAVE_LDAP_H)
+ message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
+ set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used
+ elseif(NOT HAVE_LIBLDAP)
+ message(STATUS "LDAP library '${CMAKE_LDAP_LIB}' not found CURL_DISABLE_LDAP set ON")
+ set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used
+ else()
+ if(CMAKE_USE_OPENLDAP)
+ set(USE_OPENLDAP ON)
+ endif()
+ if(CMAKE_LDAP_INCLUDE_DIR)
+ include_directories(${CMAKE_LDAP_INCLUDE_DIR})
+ endif()
+ set(NEED_LBER_H ON)
+ set(_HEADER_LIST)
+ if(HAVE_WINDOWS_H)
+ list(APPEND _HEADER_LIST "windows.h")
+ endif()
+ if(HAVE_SYS_TYPES_H)
+ list(APPEND _HEADER_LIST "sys/types.h")
+ endif()
+ list(APPEND _HEADER_LIST "ldap.h")
- set(_SRC_STRING "")
- foreach(_HEADER ${_HEADER_LIST})
- set(_INCLUDE_STRING "${_INCLUDE_STRING}#include <${_HEADER}>\n")
- endforeach()
+ set(_SRC_STRING "")
+ foreach(_HEADER ${_HEADER_LIST})
+ set(_INCLUDE_STRING "${_INCLUDE_STRING}#include <${_HEADER}>\n")
+ endforeach()
- set(_SRC_STRING
- "
- ${_INCLUDE_STRING}
- int main(int argc, char ** argv)
- {
- BerValue *bvp = NULL;
- BerElement *bep = ber_init(bvp);
- ber_free(bep, 1);
- return 0;
- }"
- )
- set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DLDAP_DEPRECATED=1")
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LDAP_LIB})
- if(HAVE_LIBLBER)
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LBER_LIB})
- endif()
- check_c_source_compiles("${_SRC_STRING}" NOT_NEED_LBER_H)
+ set(_SRC_STRING
+ "
+ ${_INCLUDE_STRING}
+ int main(int argc, char ** argv)
+ {
+ BerValue *bvp = NULL;
+ BerElement *bep = ber_init(bvp);
+ ber_free(bep, 1);
+ return 0;
+ }"
+ )
+ set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DLDAP_DEPRECATED=1")
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LDAP_LIB})
+ if(HAVE_LIBLBER)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LBER_LIB})
+ endif()
+ check_c_source_compiles("${_SRC_STRING}" NOT_NEED_LBER_H)
- if(NOT_NEED_LBER_H)
- set(NEED_LBER_H OFF)
- else()
- set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -DNEED_LBER_H")
+ if(NOT_NEED_LBER_H)
+ set(NEED_LBER_H OFF)
+ else()
+ set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -DNEED_LBER_H")
+ endif()
endif()
endif()