aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-28 14:34:58 -0700
committerChris Robinson <[email protected]>2018-03-28 14:34:58 -0700
commitcae4b1a062b53dd25eba7caa41622be730106749 (patch)
treeb57ee14c7d1a987e9c5c64e97e0e8fc338a4d917
parent2b16ff3ca8411e27daf621e06a6e651309dbb6b8 (diff)
Don't specify macros as arguments to CHECK_INCLUDE_FILE(S)
-rw-r--r--CMakeLists.txt15
1 files changed, 13 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index df1dfe63..07454f15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -577,7 +577,12 @@ ENDIF()
# Check if we have Windows headers
-CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
+SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
+SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
+CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
+SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
+UNSET(OLD_REQUIRED_DEFINITIONS)
+
IF(NOT HAVE_WINDOWS_H)
CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
IF(NOT HAVE_GETTIMEOFDAY)
@@ -975,8 +980,11 @@ OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
IF(HAVE_WINDOWS_H)
+ SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
+ SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
+
# Check MMSystem backend
- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
+ CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
IF(HAVE_MMSYSTEM_H)
CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
IF(HAVE_LIBWINMM)
@@ -1013,6 +1021,9 @@ IF(HAVE_WINDOWS_H)
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.c)
ENDIF()
ENDIF()
+
+ SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
+ UNSET(OLD_REQUIRED_DEFINITIONS)
ENDIF()
IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")