From: Viktor Szakats Date: Sat, 5 Oct 2024 00:12:13 +0000 (+0200) Subject: cmake: replace `check_include_file_concat()` for LDAP and GSS detection X-Git-Tag: curl-8_11_0~179 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91d451b48809f20415ba8627786f5d4f5aaf8bfe;p=thirdparty%2Fcurl.git 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 30e267eb0a..2a7e14f55a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()