cmake: limit pkg-config to UNIX and MSVC+vcpkg by default

Limits `pkg-config` to UNIX and MSVC with vcpkg, by default. Compared to
curl 8.9.1, this unlocks `pkg-config` on MSVC with vcpkg.

This condition might be updated in the future depending on where
`pkg-config` can be useful without breaking things. (e.g. to non-cross
MINGW, or all MINGW).

In the meantime everyone is free to override the default and test their
build with `pkg-config` by setting the `CURL_USE_PKGCONFIG=ON` CMake
option.

Closes #14575
This commit is contained in:
Viktor Szakats 2024-08-17 01:08:45 +02:00
parent 211cbcb4f6
commit c555ab469d
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 2 additions and 2 deletions

View file

@ -24,7 +24,7 @@
@PACKAGE_INIT@
if(NOT DEFINED CURL_USE_PKGCONFIG)
if(NOT MSVC OR VCPKG_TOOLCHAIN)
if(UNIX OR (MSVC AND VCPKG_TOOLCHAIN)) # Keep this in sync with root CMakeLists.txt
set(CURL_USE_PKGCONFIG ON)
else()
set(CURL_USE_PKGCONFIG OFF)

View file

@ -208,7 +208,7 @@ else()
endif()
# Override to force-disable or force-enable the use of pkg-config.
if(NOT MSVC OR VCPKG_TOOLCHAIN)
if(UNIX OR (MSVC AND VCPKG_TOOLCHAIN)) # Keep this in sync with CMake/curl-config.cmake.in
set(_curl_use_pkgconfig_default ON)
else()
set(_curl_use_pkgconfig_default OFF)