]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: allow `CURL_STATIC_CRT` with shared libcurl and no curl exe
authorViktor Szakats <commit@vsz.me>
Fri, 28 Feb 2025 03:56:12 +0000 (04:56 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 28 Feb 2025 12:11:41 +0000 (13:11 +0100)
Follow-up to edfa537100d6b5d2ac1b829c66757880afe59407 #16456

Closes #16516

CMakeLists.txt
docs/INSTALL-CMAKE.md

index 0f0fa1a66870da86aaef5bf33ace41a6421b89e1..a7962d710aee64d7d284109b9b74598652805c05 100644 (file)
@@ -352,13 +352,12 @@ endif()
 if(WIN32)
   option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
   if(CURL_STATIC_CRT AND MSVC)
-    if(BUILD_STATIC_CURL)
+    if(BUILD_STATIC_CURL OR NOT BUILD_CURL_EXE)
       set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
       string(APPEND CMAKE_C_FLAGS_RELEASE " -MT")
       string(APPEND CMAKE_C_FLAGS_DEBUG " -MTd")
     else()
-      message(WARNING "Static CRT requires curl executable built with static libcurl "
-        "(BUILD_STATIC_LIBS=ON and BUILD_STATIC_CURL=ON).")
+      message(WARNING "Static CRT requires static or no curl executable.")
     endif()
   endif()
 endif()
index 1ff046c2ccd51c19c81e07ff0066f46e10f94fee..d3439662e4ad69437e61ccee45fa2b6d7922fbef 100644 (file)
@@ -238,7 +238,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
 - `CURL_LIBCURL_VERSIONED_SYMBOLS`:         Enable libcurl versioned symbols. Default: `OFF`
 - `CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX`:  Override default versioned symbol prefix. Default: `<TLS-BACKEND>_` or `MULTISSL_`
 - `CURL_LTO`:                               Enable compiler Link Time Optimizations. Default: `OFF`
-- `CURL_STATIC_CRT`:                        Build libcurl with static CRT with MSVC (`/MT`) (requires static curl executable). Default: `OFF`
+- `CURL_STATIC_CRT`:                        Build libcurl with static CRT with MSVC (`/MT`) (requires static or no curl executable). Default: `OFF`
 - `CURL_TARGET_WINDOWS_VERSION`:            Minimum target Windows version as hex string.
 - `CURL_TEST_BUNDLES`:                      Bundle `libtest` and `unittest` tests into single binaries. Default: `OFF`
 - `CURL_WERROR`:                            Turn compiler warnings into errors. Default: `OFF`