diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-04-10 15:56:46 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-04-10 16:04:43 +0100 |
commit | 7e3f22ab499fae4a4370f4d1d385ada9941edb87 (patch) | |
tree | 012296937cc766043d6e00fc16817fdf4a31ad97 /CMakeLists.txt | |
parent | 34d047c48c89aa5f7310e48f3ec326c3ff40598c (diff) |
cmake: Fix WINVER for XP.
It was to be bumped including DirectComposition headers on MinGW, but
it shouldn't have been commited.
Instead introduce a WINDOWS_XP option to build XP binaries with MinGW.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 61fc6dd9..1b05dd6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ endif () # prescribed in http://www.gentoo.org/proj/en/qa/automagic.xml set (ENABLE_GUI "AUTO" CACHE STRING "Enable Qt GUI.") +option (WINDOWS_XP "Target Windows XP (on MinGW)" OFF) + option (ENABLE_CLI "Enable command Line interface." ON) option (ENABLE_EGL "Enable EGL support." ON) @@ -128,9 +130,24 @@ if (MSVC) endif () if (WIN32) + if (CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") + set (WINDOWS_XP TRUE) + endif () + + # http://msdn.microsoft.com/en-us/library/aa383745.aspx + if (WINDOWS_XP) + # Windows XP + add_definitions (-D_WIN32_WINNT=0x0501 -DWINVER=0x0501) + else () + # Windows 8 + add_definitions (-D_WIN32_WINNT=0x0602 -DWINVER=0x0602) + endif () + find_package (DirectX) - if (DEFINED MSVC_VERSION AND NOT DirectX_D3D11_3_INCLUDE_FOUND AND NOT CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") + if (WINDOWS_XP) + set (DirectX_D3D11_3_INCLUDE_FOUND FALSE) + elseif (DEFINED MSVC_VERSION AND NOT DirectX_D3D11_3_INCLUDE_FOUND) if (${MSVC_VERSION} LESS 1900) message (FATAL_ERROR "Windows 10 SDK (https://dev.windows.com/en-us/downloads/windows-10-sdk) must be installed for D3D11.3 support") else () @@ -185,14 +202,6 @@ add_definitions ( ) if (WIN32) - # http://msdn.microsoft.com/en-us/library/aa383745.aspx - if (MINGW OR CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") - # Windows XP - add_definitions (-D_WIN32_WINNT=0x0602 -DWINVER=0x0602) - else () - # Windows 7 - add_definitions (-D_WIN32_WINNT=0x0602 -DWINVER=0x0602) - endif () else (WIN32) CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" CXX_COMPILER_FLAG_VISIBILITY) if (CXX_COMPILER_FLAG_VISIBILITY) |