Added script to identify the Windows version used to compile the source. Currently the windows version for Windows NT is hard coded into the source. By running this CMake script the _WIN32_WINNT preprocessor variable gets set to the corresponding windows version.remotes/origin/Deprecated_master_20th_November_2022
parent
e8f7eeb5dc
commit
09eefd7973
@ -0,0 +1,22 @@
|
||||
# - If Windows is used, this script sets the variable WIN32_WINNT to the corresponding windows version
|
||||
|
||||
if (WIN32)
|
||||
message(STATUS "Checking windows version...")
|
||||
macro(get_WIN32_WINNT version)
|
||||
if (CMAKE_SYSTEM_VERSION)
|
||||
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
|
||||
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
|
||||
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
|
||||
if ("${verMajor}" MATCHES "10")
|
||||
set(verMajor "A")
|
||||
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
|
||||
endif ("${verMajor}" MATCHES "10")
|
||||
# Remove all remaining '.' characters.
|
||||
string(REPLACE "." "" ver ${ver})
|
||||
# Prepend each digit with a zero.
|
||||
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
|
||||
set(${version} "0x${ver}")
|
||||
endif(CMAKE_SYSTEM_VERSION)
|
||||
endmacro(get_WIN32_WINNT)
|
||||
endif(WIN32)
|
Loading…
Reference in new issue