← Commit list

20ae14a322

Viktor Szakats
Viktor Szakats
2026-02-13
SUCCESS Duration: 318s

Subject

cmake: warn for invalid `CURL_TARGET_WINDOWS_VERSION` values

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

CMakeLists.txt+6 -2
@@ -201,8 +201,12 @@ if(WIN32)
set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
if(CURL_TARGET_WINDOWS_VERSION)
- set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
- list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") # Apply to all feature checks
+ if(CURL_TARGET_WINDOWS_VERSION MATCHES "^0x[0-9a-fA-F]+$")
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") # Apply to all feature checks
+ else()
+ message(WARNING "CURL_TARGET_WINDOWS_VERSION value '${CURL_TARGET_WINDOWS_VERSION}' is not a valid hex string.")
+ endif()
endif()
# Detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
docs/INSTALL-CMAKE.md+1 -1
@@ -249,7 +249,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `CURL_LTO`: Enable compiler Link Time Optimizations. Default: `OFF`
- `CURL_PATCHSTAMP`: Set security patch string for `curl -V`/`curl --version` output.
- `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires UCRT, static libcurl or no curl executable). Default: `OFF`
-- `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string.
+- `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string, e.g. `0x0a00` for Windows 10.
- `CURL_WERROR`: Turn compiler warnings into errors. Default: `OFF`
- `ENABLE_CURL_MANUAL`: Build the man page for curl and enable its `-M`/`--manual` option. Default: `ON`
- `ENABLE_DEBUG`: Enable curl debug features (for developing curl itself). Default: `OFF`