base: Set the correct Windows preprocessor var for asio

Fix C4996 warning

Co-authored-by: PatTheMav <PatTheMav@users.noreply.github.com>
This commit is contained in:
tytan652 2022-07-26 22:34:47 +02:00 committed by tt2468
parent 190a9551f6
commit 420e600864

View File

@ -144,6 +144,20 @@ endif()
# Random other things
if(WIN32)
add_definitions(-D_WEBSOCKETPP_CPP11_STL_)
# Set the correct Windows preprocessor var for asio
macro(get_WIN32_WINNT version)
if (WIN32 AND CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REPLACE "." "" ver ${ver})
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif()
endmacro()
get_WIN32_WINNT(ver)
add_definitions(-D_WIN32_WINNT=${ver})
elseif(UNIX AND NOT APPLE)
target_compile_options(
obs-websocket PRIVATE -Wall -Wextra -Wno-missing-field-initializers