cmake: respect cflags/libdirs of native pkg-config detections

In Find modules with native pkg-config detection (libgsasl, libidn2,
libssh, libuv, nettle) use the C compiler flags returned by pkg-config.
Also use the library paths, and return the pathless library names.

Also:
- add these library paths to `libcurl.pc`/`curl-config`.
- fix libgsasl detection to use the detected header directory.

FindGSS already did this before this patch.

Fixes #14641

Closes #14652
This commit is contained in:
Viktor Szakats 2024-08-22 17:05:54 +02:00
parent 4f09967a3c
commit 7c0b6eb3bd
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 46 additions and 8 deletions

View file

@ -33,6 +33,8 @@
# LIBIDN2_FOUND System has libidn2
# LIBIDN2_INCLUDE_DIRS The libidn2 include directories
# LIBIDN2_LIBRARIES The libidn2 library names
# LIBIDN2_LIBRARY_DIRS The libidn2 library directories
# LIBIDN2_CFLAGS Required compiler flags
# LIBIDN2_VERSION Version of libidn2
if(CURL_USE_PKGCONFIG AND
@ -43,7 +45,7 @@ if(CURL_USE_PKGCONFIG AND
endif()
if(LIBIDN2_FOUND)
set(LIBIDN2_LIBRARIES ${LIBIDN2_LINK_LIBRARIES})
string(REPLACE ";" " " LIBIDN2_CFLAGS "${LIBIDN2_CFLAGS}")
message(STATUS "Found Libidn2 (via pkg-config): ${LIBIDN2_INCLUDE_DIRS} (found version \"${LIBIDN2_VERSION}\")")
else()
find_path(LIBIDN2_INCLUDE_DIR NAMES "idn2.h")