]> git.ipfire.org Git - thirdparty/curl.git/commit
cmake: allow `pkg-config` in more envs
authorViktor Szakats <commit@vsz.me>
Sat, 10 Aug 2024 07:33:18 +0000 (09:33 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 12 Aug 2024 12:57:10 +0000 (14:57 +0200)
commit9dfdc6ff42ba045ec48056bb6d2072f2fcac2e9d
treebac5e495c07ab920975ca6a0de817a5bac1fdc30
parentd222dbe788dd529a9a14035f205e6c6e944aca5e
cmake: allow `pkg-config` in more envs

Before this patch, `pkg-config` was used for `UNIX` builds only (with
a few exceptions like wolfSSL, libssh, gsasl, libuv). This patch extends
`pkg-config` use to all envs except: `MSVC` without vcpkg. Meaning MSVC
with vcpkg will now use it. Also mingw on Windows.

Also apply the new condition to options where `pkg-config` was used
unconditionally (= for all targets). These are:
`-DCURL_USE_WOLFSSL=ON`, `-DCURL_USE_LIBSSH=ON`,
`-DCURL_USE_GSASL=ON` and `-DCURL_USE_LIBUV=ON`

This patch may still cause regressions for cross-builds (e.g. mingw
cross-build from Unix) and potentially other cases. If that happens, we
recommend using some of these methods to explicitly disable `pkg-config`
when using CMake:
- CMake option: `-DPKG_CONFIG_EXECUTABLE=`
  (or `-DPKG_CONFIG_EXECUTABLE=nonexistent` or similar)
  This is similar to the (curl-specific) `PKG_CONFIG` env for autotools.
- export env: `PKG_CONFIG_LIBDIR=`
  (or `PKG_CONFIG_PATH`, `PKG_CONFIG_SYSROOT_DIR`,
  or the CMake-specific `PKG_CONFIG`)

We may improve control over this in a future patch, also allowing opting
in MSVC (without vcpkg).

Ref: #14405
Ref: #14408
Ref: #14140
Closes #14483
CMake/FindGSS.cmake
CMake/FindMSH3.cmake
CMake/FindNGHTTP2.cmake
CMake/FindNGHTTP3.cmake
CMake/FindNGTCP2.cmake
CMake/FindNettle.cmake
CMake/FindQUICHE.cmake
CMake/FindWolfSSL.cmake
CMake/FindZstd.cmake
CMakeLists.txt