mirror of
https://github.com/curl/curl.git
synced 2026-07-30 11:28:05 +03:00
cmake: use OpenSSL for LDAP detection only if available
Also unset `CMAKE_REQUIRED_LIBRARIES` in two error branches. Reported-by: Vollstrecker on github Fixes #15077 Closes #15152
This commit is contained in:
parent
e9eda865df
commit
b171ee6019
1 changed files with 6 additions and 1 deletions
|
|
@ -960,7 +960,10 @@ if(NOT CURL_DISABLE_LDAP)
|
|||
# Now that we know, we are not using Windows LDAP...
|
||||
if(NOT USE_WIN32_LDAP)
|
||||
# Check for LDAP
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(USE_OPENSSL)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
check_library_exists("${CMAKE_LDAP_LIB}" "ldap_init" "" HAVE_LIBLDAP)
|
||||
if(HAVE_LIBLDAP)
|
||||
check_library_exists("${CMAKE_LDAP_LIB};${CMAKE_LBER_LIB}" "ber_init" "" HAVE_LIBLBER)
|
||||
|
|
@ -980,10 +983,12 @@ if(NOT CURL_DISABLE_LDAP)
|
|||
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 will not be used
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
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 will not be used
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
else()
|
||||
if(CMAKE_LDAP_INCLUDE_DIR)
|
||||
include_directories(SYSTEM ${CMAKE_LDAP_INCLUDE_DIR})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue