Change #286442
| Category | curl |
| Changed by | Viktor Szakats <commit@vsz.me> |
| Changed at | Fri 16 Oct 2026 12:10:27 |
| Repository | https://github.com/curl/curl.git |
| Project | curl |
| Branch | master |
| Revision | af9d2ddc735baae0cfa3fd8435d134589441afd4 |
Comments
cmake: fix preconditions for option `CURL_STATIC_CRT=ON` Limit this option to static-only curl builds. Enabling the static CRT for other configurations may successfuly build them, but executing them do run into nasty problems due to using two CRT copies at the same time. Also note that the static CRT setting applies to tests too, which revealed these issues. Also: - as it turns out, static CRT may be enabled for non-UCRT builds. After this patch, such configuration is possible again. - note, if these preconditions prevent doing a desired static-CRT build variation (e.g. a libcurl.dll built against static CRT). You can pass the necessary compiler/linker options via standard CMake options/envs. I discovered these issues while enabling test runs on AppVeyor CI with all supported MSVC version in various configurations, and `-DCURL_STATIC_CRT=ON` set. Symptoms of double CRT: - `curl -V` output with newline missing between 'Protocols:' and 'Features:' lines, then runtests unable to detect feature and emitting a Perl warning for uninitialized `$feat` variable. (due to parallel output buffering for `puts()` and `curl_mprintf()`) This is visible in master builds, e.g.: CM VS2019, Debug, x64, OpenSSL 3.0 + Schannel, Shared, !verbose, Build-tests: ``` WARNING: this libcurl is Debug-enabled, do not use in production curl 8.23.0-DEV (Windows) libcurl/8.23.0-DEV OpenSSL/3.0.18 (Schannel) WinLDAP Release-Date: [unreleased] Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtsp smtp smtps telnet tftp ws wssFeatures: alt-svc AsynchDNS Debug HSTS HTTPS-proxy HTTPSIG IPv6 Kerberos Largefile MultiSSL SPNEGO SSL SSPI threadsafe UnixSockets ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/54865570/job/urr2rgnr32hwllw2#L246 Notice the missing newline before `Features:`, and appearing above `WARNING:` instead. - test1622 failing. - 'Debug Assertion Failed! Expression: _acrt_first_block == header' crashed in both the app and the libcurl.dll it loaded. (possibly) Follow-up to 61407464bf049ec013879e236e7f0bfae343ae16 #16522 Follow-up to 049352dd80e1ab73945c49a3bac2e4a08db32f98 #16516 Follow-up to edfa537100d6b5d2ac1b829c66757880afe59407 #16456 #16394 Follow-up to 4fc6ebe18a607764194ee23e5aa898a027fe3c60 #1621 Cherry-picked from #23306 Closes #23336
Changed files
- CMakeLists.txt
- docs/INSTALL-CMAKE.md