--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1092,17 +1092,24 @@ IF(HAVE_WINDOWS_H) ENDIF() # Check DSound backend - FIND_PACKAGE(DSound) - IF(DSOUND_FOUND) - OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) - IF(ALSOFT_BACKEND_DSOUND) - SET(HAVE_DSOUND 1) - SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) - ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) - SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) - ENDIF() - ENDIF() + check_include_file(dsound.h HAVE_DSOUND_H) + if(DXSDK_DIR) + find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" + PATHS "${DXSDK_DIR}" PATH_SUFFIXES include + DOC "The DirectSound include directory") + endif() + if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) + option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) + if(ALSOFT_BACKEND_DSOUND) + set(HAVE_DSOUND 1) + set(BACKENDS "${BACKENDS} DirectSound,") + set(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) + + if(NOT HAVE_DSOUND_H) + set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) + endif() + endif() + endif() # Check for WASAPI backend CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)