Commit b70ca528 authored by Sergei Nikulov's avatar Sergei Nikulov Committed by Jay Satiro
Browse files

cmake: Fix build with winldap

Bug: https://github.com/curl/curl/pull/874
Reported-by: Sergei Nikulov
parent f77dfbc5
Loading
Loading
Loading
Loading
+63 −64
Original line number Diff line number Diff line
@@ -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()
@@ -351,15 +350,14 @@ if(NOT CURL_DISABLE_LDAP)
  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")
@@ -423,6 +421,7 @@ if(NOT CURL_DISABLE_LDAP)
        set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -DNEED_LBER_H")
      endif()
    endif()
  endif()

endif()