cmake: Fix the FindCURL module (#351573)

This commit is contained in:
Vladimír Čunát 2024-11-07 11:16:06 +01:00
commit 6b50ea9237
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 5ce8a9046b..f7361308b7 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -239,9 +239,24 @@ if(CURL_FOUND)
IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}")
endif()
- if(CURL_USE_STATIC_LIBS AND MSVC)
- set_target_properties(CURL::libcurl PROPERTIES
- INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib")
+ if(PC_CURL_FOUND)
+ if(PC_CURL_LINK_LIBRARIES)
+ set_property(TARGET CURL::libcurl PROPERTY
+ INTERFACE_LINK_LIBRARIES "${PC_CURL_LINK_LIBRARIES}")
+ endif()
+ if(PC_CURL_LDFLAGS_OTHER)
+ set_property(TARGET CURL::libcurl PROPERTY
+ INTERFACE_LINK_OPTIONS "${PC_CURL_LDFLAGS_OTHER}")
+ endif()
+ if(PC_CURL_CFLAGS_OTHER)
+ set_property(TARGET CURL::libcurl PROPERTY
+ INTERFACE_COMPILE_OPTIONS "${PC_CURL_CFLAGS_OTHER}")
+ endif()
+ else()
+ if(CURL_USE_STATIC_LIBS AND MSVC)
+ set_target_properties(CURL::libcurl PROPERTIES
+ INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib")
+ endif()
endif()
endif()

View File

@ -76,7 +76,12 @@ stdenv.mkDerivation (finalAttrs: {
substituteAll {
src = ./007-darwin-bsd-ps-abspath.diff;
ps = lib.getExe ps;
});
})
++ [
# Backport of https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9900
# Needed to corretly link curl in pkgsStatic.
./008-FindCURL-Add-more-target-properties-from-pkg-config.diff
];
outputs = [ "out" ] ++ lib.optionals buildDocs [ "man" "info" ];
separateDebugInfo = true;