cmake: replace check_include_file_concat() for LDAP and GSS detection

Replace `check_include_file_concat()` with `check_include_file()` in
GSS/LDAP detection to avoid these headers spilling into subsequent
feature checks.

- For LDAP, reverse detection order to match with `./configure`.
  Though, in current LDAP packages `ldap.h` does include `lber.h`.

- For GSS, align header detection logic with `./configure`, where
  `gssapi/gssapi_generic.h` might require `gssapi/gssapi.h`, and
  `gssapi/gssapi_krb5.h` might require both.

Ref: #436
Closes #15157
This commit is contained in:
Viktor Szakats 2024-10-05 02:12:13 +02:00
parent 2c90f7f69e
commit 91d451b488
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201

View File

@ -1007,8 +1007,14 @@ if(NOT CURL_DISABLE_LDAP)
if(LDAP_INCLUDE_DIR)
list(APPEND CMAKE_REQUIRED_INCLUDES ${LDAP_INCLUDE_DIR})
endif()
check_include_file_concat("ldap.h" HAVE_LDAP_H)
check_include_file_concat("lber.h" HAVE_LBER_H)
unset(_include_list)
check_include_file("lber.h" HAVE_LBER_H)
if(HAVE_LBER_H)
list(APPEND _include_list "lber.h")
endif()
check_include_files("${_include_list};ldap.h" HAVE_LDAP_H)
unset(_include_list)
if(NOT HAVE_LDAP_H)
message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
@ -1203,12 +1209,15 @@ if(CURL_USE_GSSAPI)
endforeach()
if(NOT GSS_FLAVOUR STREQUAL "GNU")
check_include_file_concat("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
check_include_file_concat("gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
set(_include_list "")
check_include_file("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
if(HAVE_GSSAPI_GSSAPI_H)
list(APPEND _include_list "gssapi/gssapi.h")
endif()
check_include_files("${_include_list};gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
if(GSS_FLAVOUR STREQUAL "MIT")
check_include_file_concat("gssapi/gssapi_krb5.h" _have_gssapi_gssapi_krb5_h)
set(_include_list "")
check_include_files("${_include_list};gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H)
if(HAVE_GSSAPI_GSSAPI_H)
list(APPEND _include_list "gssapi/gssapi.h")
endif()
@ -1228,6 +1237,7 @@ if(CURL_USE_GSSAPI)
set(HAVE_OLD_GSSMIT ON)
endif()
endif()
unset(_include_list)
endif()
cmake_pop_check_state()