Skip to content

Commit 69edf7d

Browse files
committed
Try schannel on MSYS2
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 5f2da13 commit 69edf7d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
uses: msys2/setup-msys2@v2
7878
if: matrix.platform.shell == 'msys2 {0}'
7979
with:
80-
install: cmake make gcc ca-certificates
80+
install: cmake make gcc
8181

8282
- uses: actions/checkout@v4
8383
- name: Install dependencies (macOS)

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "MSYS")
3939
endif()
4040

4141
find_package(ZLIB REQUIRED)
42-
# mbedTLS is only used on non-Windows platforms (Windows uses Schannel for SSL)
43-
if(NOT WIN32)
42+
# mbedTLS is only used on Unix platforms (Windows/MSYS2 use Schannel for SSL)
43+
if(NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "MSYS")
4444
find_package(MbedTLS REQUIRED)
4545
endif()
4646
find_package(Nghttp2 REQUIRED)

cmake/FindCURL.cmake

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)