]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: expand `CURL_USE_PKGCONFIG` to non-cross `MINGW`
authorViktor Szakats <commit@vsz.me>
Tue, 20 Aug 2024 09:13:19 +0000 (11:13 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 20 Sep 2024 22:59:51 +0000 (00:59 +0200)
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

CMake/curl-config.cmake.in
CMakeLists.txt

index 773dad32ca00bb4e228e513830ff16daa4a8bf11..e62731d70d20486a4abb712cc4e089be854cea6f 100644 (file)
 ###########################################################################
 @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@)
index dd5693bf0c6a98ce14614f06d9fe49198cd24900..8a7b40109595b92ef844b3162566262f6ef66712 100644 (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)