-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: expand CURL_USE_PKGCONFIG
to non-cross MINGW
#14658
Conversation
239e90d
to
0236f8e
Compare
Why? Cross-compiling or not, pkg-config is always much better than cmake modules for MinGW. Most cmake modules don't pass private dependencies and cflags at all, which makes them completely useless for static builds. |
0236f8e
to
7d03667
Compare
It's a matter of enabling it with |
7d03667
to
caf612c
Compare
I just noticed that vcpkg also supports -if(UNIX OR (MSVC AND VCPKG_TOOLCHAIN) OR (MINGW AND NOT CMAKE_CROSSCOMPILING))
+if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) (perhaps in a separate PR) |
This is to support mingw under vcpkg.
caf612c
to
5a6c35d
Compare
That's why I use it... The CMake config must also use a cache variable, so that users can change it at time of use. |
I guess that is something difficult to guess from a distance :) In discussions/proposals, no one said a word about mingw support in vcpkg. This is now on track for the next release.
Would you mind posting a diff to illustrate what you mean? |
I realize now that external input is respected in form of
My suggestion is to use the same pattern as in --- 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 CURL dependencies" ${_curl_use_pkgconfig_default})
include(CMakeFindDependencyMacro)
if(@USE_OPENSSL@) |
@dg0yt Thanks. If I read it right, A nit I suggest changing is Would you want to open a PR with this? |
Enable `CURL_USE_PKGCONFIG` by default for MinGW cross-builds. Note: This may cause fallouts in certain envs where pkg-config picks up native packages. Follow-up to e1ab01d curl#14658 Follow-up to c555ab4 curl#14575
Enable
CURL_USE_PKGCONFIG
by default for more environments:MINGW
targets when not using cross-compilation.also unlocked by the update above.)
Also:
CURL_USE_PKGCONFIG
inCURLConfig.cmake
.Suggested-by: Kai Pastor
Follow-up to c555ab4 #14575