cmake: expand CURL_USE_PKGCONFIG to non-cross MINGW

Enable `CURL_USE_PKGCONFIG` by default for more environments:

- for `MINGW` targets when not using cross-compilation.
- stop restricting vcpkg to MSVC. (this currently unlocks mingw,
  also unlocked by the update above.)

Also:
- cache `CURL_USE_PKGCONFIG` in `CURLConfig.cmake`.
  Suggested-by: Kai Pastor

Follow-up to c555ab469d #14575
Closes #14658
This commit is contained in:
Viktor Szakats 2024-08-20 11:13:19 +02:00
parent c5e3d8ba94
commit e1ab01d1bd
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 6 additions and 7 deletions

View File

@ -23,13 +23,12 @@
###########################################################################
@PACKAGE_INIT@
if(NOT DEFINED CURL_USE_PKGCONFIG)
if(UNIX OR (MSVC AND VCPKG_TOOLCHAIN)) # Keep in sync with root CMakeLists.txt
set(CURL_USE_PKGCONFIG ON)
else()
set(CURL_USE_PKGCONFIG OFF)
endif()
if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) # Keep in sync with root CMakeLists.txt
set(_curl_use_pkgconfig_default ON)
else()
set(_curl_use_pkgconfig_default OFF)
endif()
option(CURL_USE_PKGCONFIG "Enable pkg-config to detect @PROJECT_NAME@ dependencies" ${_curl_use_pkgconfig_default})
include(CMakeFindDependencyMacro)
if(@USE_OPENSSL@)

View File

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