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
c555ab469d74756b0e3a21f797237d53f9334ce3 #14575
Closes #14658
###########################################################################
@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@)
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)