mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -05:00
CMake: support specifying the target Windows version
Previously, it was only possible to set it to Windows Vista or XP by setting the option `ENABLE_INET_PTON` to `ON` resp. `OFF`. Use a new cache variable `CURL_TARGET_WINDOWS_VERSION` to be able to explicitly set the target Windows version. `ENABLE_INET_PTON` is ignored in this case. Ref: https://github.com/curl/curl/pull/1639#issuecomment-313039352 Ref: https://github.com/curl/curl/pull/4607#issuecomment-557541456 Closes https://github.com/curl/curl/pull/4815
This commit is contained in:
parent
ff807c16d2
commit
295ea5f641
@ -79,6 +79,16 @@ option(ENABLE_ARES "Set to ON to enable c-ares support" OFF)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
option(CURL_STATIC_CRT "Set to ON to build libcurl with static CRT on Windows (/MT)." OFF)
|
option(CURL_STATIC_CRT "Set to ON to build libcurl with static CRT on Windows (/MT)." OFF)
|
||||||
option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON)
|
option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON)
|
||||||
|
set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
|
||||||
|
if(CURL_TARGET_WINDOWS_VERSION)
|
||||||
|
add_definitions(-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION})
|
||||||
|
elseif(ENABLE_INET_PTON)
|
||||||
|
# _WIN32_WINNT_VISTA (0x0600)
|
||||||
|
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||||
|
else()
|
||||||
|
# _WIN32_WINNT_WINXP (0x0501)
|
||||||
|
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
option(CURL_LTO "Turn on compiler Link Time Optimizations" OFF)
|
option(CURL_LTO "Turn on compiler Link Time Optimizations" OFF)
|
||||||
|
|
||||||
@ -858,16 +868,6 @@ elseif(HAVE_LIBSOCKET)
|
|||||||
set(CMAKE_REQUIRED_LIBRARIES socket)
|
set(CMAKE_REQUIRED_LIBRARIES socket)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
if(ENABLE_INET_PTON)
|
|
||||||
# _WIN32_WINNT_VISTA (0x0600)
|
|
||||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
|
||||||
else()
|
|
||||||
# _WIN32_WINNT_WINXP (0x0501)
|
|
||||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
||||||
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
||||||
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
||||||
|
Loading…
Reference in New Issue
Block a user