@@ -434,10 +434,11 @@ if(NOT CURL_FOUND)
434434 target_compile_definitions (curl PRIVATE _UNICODE)
435435 target_compile_definitions (curl PRIVATE HTTP_ONLY)
436436 target_compile_definitions (curl PRIVATE ENABLE_IPV6)
437- # SSL/TLS backend: Use Schannel (native) on Windows, mbedTLS on other platforms
438- # Schannel automatically uses the Windows Certificate Store for certificate validation
437+ # SSL/TLS backend: Use Schannel (native) on all Windows platforms (MSVC and MSYS2),
438+ # mbedTLS on Unix platforms. Schannel automatically uses the Windows Certificate Store
439+ # for certificate validation, eliminating the need for manual certificate management.
439440 # Note: Secure Transport was deprecated by Apple and removed from CURL 8.0+
440- if (WIN32 )
441+ if (WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "MSYS" )
441442 target_compile_definitions (curl PRIVATE USE_SCHANNEL)
442443 target_compile_definitions (curl PRIVATE USE_WINDOWS_SSPI)
443444 else ()
@@ -489,8 +490,7 @@ if(NOT CURL_FOUND)
489490 target_compile_definitions (curl PRIVATE _POSIX_C_SOURCE=200809L)
490491 elseif (CMAKE_SYSTEM_NAME STREQUAL "MSYS" )
491492 target_compile_definitions (curl PRIVATE CURL_OS="MSYS" )
492- target_compile_definitions (curl PRIVATE CURL_CA_BUNDLE="/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" )
493- target_compile_definitions (curl PRIVATE CURL_CA_PATH="/etc/ssl/certs" )
493+ # Note: MSYS2 uses Schannel which automatically uses Windows Certificate Store
494494 target_compile_definitions (curl PRIVATE HAVE_SYS_TIME_H)
495495 target_compile_definitions (curl PRIVATE HAVE_LONGLONG)
496496 target_compile_definitions (curl PRIVATE HAVE_RECV)
@@ -537,8 +537,8 @@ if(NOT CURL_FOUND)
537537 target_include_directories (curl PRIVATE "${CURL_DIR} /lib" )
538538
539539 target_link_libraries (curl PRIVATE ZLIB::ZLIB)
540- # Only link mbedTLS on non-Windows platforms (Windows uses Schannel)
541- if (NOT WIN32 )
540+ # Only link mbedTLS on Unix platforms (Windows/MSYS2 use Schannel)
541+ if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "MSYS" )
542542 target_link_libraries (curl PRIVATE MbedTLS::mbedtls)
543543 endif ()
544544 target_link_libraries (curl PRIVATE Nghttp2::nghttp2)
@@ -550,10 +550,10 @@ if(NOT CURL_FOUND)
550550 if (APPLE )
551551 target_link_libraries (curl PRIVATE "-framework Foundation" )
552552 target_link_libraries (curl PRIVATE "-framework SystemConfiguration" )
553- elseif (WIN32 )
553+ elseif (WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "MSYS" )
554554 target_link_libraries (curl PRIVATE ws2_32)
555- target_link_libraries (curl PRIVATE Crypt32.lib )
556- target_link_libraries (curl PRIVATE Secur32.lib ) # For SSPI/Schannel
555+ target_link_libraries (curl PRIVATE Crypt32)
556+ target_link_libraries (curl PRIVATE Secur32) # For SSPI/Schannel
557557 endif ()
558558
559559 target_include_directories (curl PUBLIC
0 commit comments