diff --git a/CMakeLists.txt b/CMakeLists.txt index e69de4d5..fa226830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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