cmake: move pkg-config names to Find modules

Make the Find modules set and return their respective `pkg-config`
module name(s) to the CMake build process, which then adds those
to the `Requires:` list.

Before this patch, `pkg-config` module names were maintainted in two
separate places. After this patch, they are maintained in the Find
modules for dependencies that have one (most do).

Re-align existing modules with this change: msh3, mbedtls, rustls.
These modules return their `pkg-config` module name only when
detected via `pkg-config`.

Follow-up to d511ec8b0a #15573
Closes #15800
This commit is contained in:
Viktor Szakats 2024-12-22 11:30:45 +01:00
parent a1eaa12a83
commit fb1883d226
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
20 changed files with 102 additions and 44 deletions

View file

@ -34,14 +34,17 @@
# - `LIBPSL_INCLUDE_DIRS`: The libpsl include directories.
# - `LIBPSL_LIBRARIES`: The libpsl library names.
# - `LIBPSL_LIBRARY_DIRS`: The libpsl library directories.
# - `LIBPSL_PC_REQUIRES`: The libpsl pkg-config packages.
# - `LIBPSL_CFLAGS`: Required compiler flags.
# - `LIBPSL_VERSION`: Version of libpsl.
set(LIBPSL_PC_REQUIRES "libpsl")
if(CURL_USE_PKGCONFIG AND
NOT DEFINED LIBPSL_INCLUDE_DIR AND
NOT DEFINED LIBPSL_LIBRARY)
find_package(PkgConfig QUIET)
pkg_check_modules(LIBPSL "libpsl")
pkg_check_modules(LIBPSL ${LIBPSL_PC_REQUIRES})
endif()
if(LIBPSL_FOUND AND LIBPSL_INCLUDE_DIRS)