]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: replace `check_include_file_concat()` for LDAP and GSS detection
authorViktor Szakats <commit@vsz.me>
Sat, 5 Oct 2024 00:12:13 +0000 (02:12 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 10 Oct 2024 20:50:44 +0000 (22:50 +0200)
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

CMakeLists.txt

index 30e267eb0a41c5cfa3701b83a289c20d5f3bd251..2a7e14f55a905b89d3db5126708dfd577acd2bbb 100644 (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()