curl/CMake
Viktor Szakats d511ec8b0a
build: omit certain deps from libcurl.pc unless found via pkg-config
The idea of linking dependencies found to `libcurl.pc` turns out not
to work in practice in some cases.

Specifically: gss, ldap, mbedtls, libmsh3, rustls

A `.pc` may not work or be missing for a couple of reasons:
- not all build methods generate it: mbedTLS, Rustls
- generated file is broken: msh3
  Ref: https://github.com/nibanks/msh3/pull/225
- installed package flavour isn't shipping with one:
  FreeBSD GSS, OmniOS LDAP, macOS LDAP

The effect of such issues shall be subtle in theory, because
`libcurl.pc` normally lists these dependencies in the `Requires.private`
section meant for static linking. But, e.g. `pkg-config --exists`
requires these to be present, and builds sometimes use this check
regardless of build type. This bug is not present in `pkgconf`; it only
checks for them when `--static` is also passed.

Fix these by adding affected `.pc` references to `libcurl.pc` only when
we detected the dependency via `pkg-config`.

There are a few side-effects of this solution:
- references are never added for dependencies where curl doesn't
  implement `pkg-config` detection. These are:
  - autotools: ldap, mbedtls, msh3
  - cmake: ldap (pending #15273)
- generated `libcurl.pc` depends on the build-time environment.
- generated `libcurl.pc` depends on curl build tool (cmake, autotools).
- generated `libcurl.pc` depends on curl build implementation details.

Make an exception for GNU GSS, where I blindly guess that `gss.pc` is
always available, as no issues were reported.

Other, not mentioned, dependencies continue to be added regardless
of the detection method.

Reported-by: Harmen Stoppels, Thomas, Daniel Engberg, Andy Fiddaman
Fixes #15469
Fixes #15507
Fixes #15535
Fixes https://github.com/curl/curl/pull/15163#issuecomment-2473358444
Closes #15573
2024-11-14 22:38:47 +01:00
..
Platforms build: use _fseeki64() on Windows, drop detections 2024-11-11 14:25:04 +01:00
cmake_uninstall.cmake.in cmake: more small tidy-ups and fixes 2024-08-08 13:48:28 +02:00
CMakeConfigurableFile.in copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-config.cmake.in cmake: tidy up 2024-09-22 09:51:15 +02:00
CurlSymbolHiding.cmake tidy-up: whitespace, fix CI spacecheck for docs 2024-10-30 23:15:28 +01:00
CurlTests.c cmake: apply WIN32_LEAN_AND_MEAN to all feature checks 2024-10-11 17:57:03 +02:00
FindBearSSL.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindBrotli.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindCares.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindGSS.cmake build: omit certain deps from libcurl.pc unless found via pkg-config 2024-11-14 22:38:47 +01:00
FindLibgsasl.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindLibidn2.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindLibpsl.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindLibssh2.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindLibssh.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindLibuv.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindMbedTLS.cmake build: omit certain deps from libcurl.pc unless found via pkg-config 2024-11-14 22:38:47 +01:00
FindMSH3.cmake build: omit certain deps from libcurl.pc unless found via pkg-config 2024-11-14 22:38:47 +01:00
FindNettle.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindNGHTTP2.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindNGHTTP3.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindNGTCP2.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindQuiche.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
FindRustls.cmake build: omit certain deps from libcurl.pc unless found via pkg-config 2024-11-14 22:38:47 +01:00
FindWolfSSH.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindWolfSSL.cmake cmake: clear package version after pkg-config detection 2024-10-25 15:04:35 +02:00
FindZstd.cmake cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
Macros.cmake cmake: use list(APPEND) on CURL_INCLUDES 2024-10-24 19:16:10 +02:00
OtherTests.cmake cmake: work around ios.toolchain.cmake breaking feature-detections 2024-11-13 10:42:38 +01:00
PickyWarnings.cmake build: fix clang-cl builds, add CI job 2024-10-30 23:15:32 +01:00
Utilities.cmake cmake: more syntax tidy-up 2024-08-07 23:41:27 +02:00