CMake: Fixed to work on Windows 8 SDK (thanks, Martin!).
authorRyan C. Gordon <icculus@icculus.org>
Tue, 29 Dec 2015 00:02:43 -0500
changeset 9979 e3d651c5fe31
parent 9978 a80ea42a4adc
child 9980 224187458d03
CMake: Fixed to work on Windows 8 SDK (thanks, Martin!). Fixes Bugzilla #3207.
CMakeLists.txt
--- a/CMakeLists.txt	Mon Dec 28 23:29:11 2015 -0500
+++ b/CMakeLists.txt	Tue Dec 29 00:02:43 2015 -0500
@@ -900,7 +900,10 @@
 
   # Check for DirectX
   if(DIRECTX)
-    if(NOT CMAKE_COMPILER_IS_MINGW)
+    if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700)
+        set(USE_WINSDK_DIRECTX TRUE)
+    endif()
+    if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX)
       if("$ENV{DXSDK_DIR}" STREQUAL "")
         message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
       endif()
@@ -926,7 +929,7 @@
     check_include_file(dxgi.h HAVE_DXGI_H)
     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
       set(HAVE_DIRECTX TRUE)
-      if(NOT CMAKE_COMPILER_IS_MINGW)
+      if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX)
       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
         link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
         include_directories($ENV{DXSDK_DIR}\\Include)
@@ -1044,7 +1047,7 @@
       list(APPEND EXTRA_LIBS dinput8 dxguid)
       if(CMAKE_COMPILER_IS_MINGW)
         list(APPEND EXTRA_LIBS dxerr8)
-      else()
+      elseif (NOT USE_WINSDK_DIRECTX)
         list(APPEND EXTRA_LIBS dxerr)
       endif()
     endif()