CMake fixes for MingW (thanks, Ozkan!). - ignore DXSDK_DIR for mingw environment - use dxerr8 instead of dxerr for mingw. Partially fixes Bugzilla #3016.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d8b95b..f1cf7aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -900,10 +900,12 @@ elseif(WINDOWS)
# Check for DirectX
if(DIRECTX)
- if("$ENV{DXSDK_DIR}" STREQUAL "")
- message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
+ if(NOT CMAKE_COMPILER_IS_MINGW)
+ if("$ENV{DXSDK_DIR}" STREQUAL "")
+ message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
+ endif()
+ set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
endif()
- set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
check_include_file(d3d9.h HAVE_D3D_H)
check_include_file(d3d11_1.h HAVE_D3D11_H)
check_include_file(ddraw.h HAVE_DDRAW_H)
@@ -914,9 +916,11 @@ elseif(WINDOWS)
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)
# 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)
+ link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
+ include_directories($ENV{DXSDK_DIR}\\Include)
+ endif()
endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif()
@@ -1020,7 +1024,12 @@ elseif(WINDOWS)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
if(HAVE_DINPUT_H)
set(SDL_JOYSTICK_DINPUT 1)
- list(APPEND EXTRA_LIBS dinput8 dxguid dxerr)
+ list(APPEND EXTRA_LIBS dinput8 dxguid)
+ if(CMAKE_COMPILER_IS_MINGW)
+ list(APPEND EXTRA_LIBS dxerr8)
+ else()
+ list(APPEND EXTRA_LIBS dxerr)
+ endif()
endif()
if(HAVE_XINPUT_H)
set(SDL_JOYSTICK_XINPUT 1)