From: Kai Pastor Date: Wed, 21 Jan 2026 08:04:14 +0000 (+0100) Subject: cmake: always define `CURL::win32_winsock` on Windows in `curl-config.cmake` X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef3101d1819928a7799309a16cc531818778e5c7;p=thirdparty%2Fcurl.git cmake: always define `CURL::win32_winsock` on Windows in `curl-config.cmake` The CMake config can be consumed by project which enable only language `CXX`. `CMAKE_C_COMPILER_ID` isn't defined in this case, and the target definition would be missing. But the check for compiler id isn't really needed: The target is namespaced and valid, regardless of actual compiler. Noticed in https://github.com/microsoft/vcpkg/issues/49518, building cpr. Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973 Closes #20382 --- diff --git a/CMake/curl-config.in.cmake b/CMake/curl-config.in.cmake index 7f346c832c..ef2a64cc91 100644 --- a/CMake/curl-config.in.cmake +++ b/CMake/curl-config.in.cmake @@ -138,7 +138,7 @@ endif() set(CMAKE_MODULE_PATH ${_curl_cmake_module_path_save}) -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND WIN32 AND NOT TARGET CURL::win32_winsock) +if(WIN32 AND NOT TARGET CURL::win32_winsock) add_library(CURL::win32_winsock INTERFACE IMPORTED) set_target_properties(CURL::win32_winsock PROPERTIES INTERFACE_LINK_LIBRARIES "ws2_32") endif()