cmake: stop adding dependency headers to global CMAKE_REQUIRED_INCLUDES

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: 118977f19d
Cherry-picked from #15157
Closes #15252
This commit is contained in:
Viktor Szakats 2024-10-05 14:01:49 +02:00
parent 91519bfb74
commit 447bcea5a4
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201

View 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()