From: Viktor Szakats Date: Tue, 20 Aug 2024 09:13:19 +0000 (+0200) Subject: cmake: expand `CURL_USE_PKGCONFIG` to non-cross `MINGW` X-Git-Tag: curl-8_11_0~387 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e1ab01d1bd13f0ec79c97ac7e19e4b8108dce270;p=thirdparty%2Fcurl.git 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 c555ab469d74756b0e3a21f797237d53f9334ce3 #14575 Closes #14658 --- diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in index 773dad32ca..e62731d70d 100644 --- a/CMake/curl-config.cmake.in +++ b/CMake/curl-config.cmake.in @@ -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@) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd5693bf0c..8a7b401095 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)