]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: stop adding dependency headers to global `CMAKE_REQUIRED_INCLUDES`
authorViktor Szakats <commit@vsz.me>
Sat, 5 Oct 2024 12:01:49 +0000 (14:01 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 10 Oct 2024 17:36:02 +0000 (19:36 +0200)
It was done for `zlib`, `brotli`, `libpsl`, `libssh2`, `wolfssh`
(a copy-paste case for `wolfssh`).

Feature detections should not rely by default on dependency headers.
There is no evidence they do now. If it becomes necessary, headers
should added for the duration of the feature check.

Ref: 118977f19d2d7e842bdf4424c7cfbc5991781412
Cherry-picked from #15157
Closes #15252

CMakeLists.txt

index ee2e6d0904738688e96b4b8f723b59a958a85c39..3594be790a2dcd8563479a54bb0a43944d2c59dd 100644 (file)
@@ -744,7 +744,6 @@ if(ZLIB_FOUND)
   # get our dependencies transitively.
   list(APPEND CURL_LIBS ZLIB::ZLIB)
   list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "zlib")
-  list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS})
 endif()
 
 option(CURL_BROTLI "Use brotli" OFF)
@@ -756,7 +755,6 @@ if(CURL_BROTLI)
     list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
     list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libbrotlidec")
     include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
-    list(APPEND CMAKE_REQUIRED_INCLUDES ${BROTLI_INCLUDE_DIRS})
   endif()
 endif()
 
@@ -1106,7 +1104,6 @@ if(CURL_USE_LIBPSL)
   if(LIBPSL_FOUND)
     list(APPEND CURL_LIBS ${LIBPSL_LIBRARIES})
     list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libpsl")
-    list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBPSL_INCLUDE_DIRS}")
     include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS})
     set(USE_LIBPSL ON)
   else()
@@ -1124,7 +1121,6 @@ if(CURL_USE_LIBSSH2)
   if(LIBSSH2_FOUND)
     list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})
     list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libssh2")
-    list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIRS}")
     include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
     set(USE_LIBSSH2 ON)
   endif()
@@ -1157,7 +1153,6 @@ if(NOT USE_LIBSSH2 AND NOT USE_LIBSSH AND CURL_USE_WOLFSSH)
     find_package(WolfSSH)
     if(WOLFSSH_FOUND)
       list(APPEND CURL_LIBS ${WOLFSSH_LIBRARIES})
-      list(APPEND CMAKE_REQUIRED_INCLUDES "${WOLFSSH_INCLUDE_DIRS}")
       include_directories(SYSTEM ${WOLFSSH_INCLUDE_DIRS})
       set(USE_WOLFSSH ON)
     endif()