Skip to content

Commit 48bbadb

Browse files
committed
Build: Add cmake option CPP-NETLIB_WINAPI_VERSION
This option allows us to setup _WIN32_WINNT definition value from cmake command line Default value is 0x0501 (_WIN32_WINNT_WINXP) https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
1 parent 604d50e commit 48bbadb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ option( CPP-NETLIB_ENABLE_HTTPS "Build cpp-netlib with support for https if Open
1515
option( CPP-NETLIB_STATIC_OPENSSL "Build cpp-netlib using static OpenSSL" OFF)
1616
option( CPP-NETLIB_STATIC_BOOST "Build cpp-netlib using static Boost" OFF)
1717

18+
if (NOT DEFINED CPP-NETLIB_WINAPI_VERSION)
19+
set(CPP-NETLIB_WINAPI_VERSION 0x0501)
20+
endif()
21+
1822
include(GNUInstallDirs)
1923

2024
# determine install path for CMake config files
@@ -116,7 +120,7 @@ endif()
116120

117121

118122
if (WIN32)
119-
target_compile_definitions(cppnetlib INTERFACE _WIN32_WINNT=0x0501)
123+
target_compile_definitions(cppnetlib INTERFACE _WIN32_WINNT=${CPP-NETLIB_WINAPI_VERSION} BOOST_USE_WINAPI_VERSION=${CPP-NETLIB_WINAPI_VERSION})
120124

121125
if (MSVC)
122126
target_compile_options(cppnetlib INTERFACE /bigobj)

0 commit comments

Comments
 (0)