diff options
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c5cbdc..bf5c37d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ IF(WIN32) OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF) ENDIF() -OPTION(ALSOFT_BACKEND_ALSA "Check for ALSA backend" ON) OPTION(ALSOFT_BACKEND_OSS "Check for OSS backend" ON) OPTION(ALSOFT_BACKEND_SOLARIS "Check for Solaris backend" ON) OPTION(ALSOFT_BACKEND_SNDIO "Check for SndIO backend" ON) @@ -50,7 +49,6 @@ OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON) OPTION(ALSOFT_REQUIRE_SSE "Require SSE/SSE2 support" OFF) OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF) -OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF) OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF) OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF) OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF) @@ -647,19 +645,20 @@ SET(HAVE_OPENSL 0) SET(HAVE_WAVE 0) # Check ALSA backend -IF(ALSOFT_BACKEND_ALSA) - CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H) - IF(HAVE_ALSA_ASOUNDLIB_H) - CHECK_SHARED_FUNCTION_EXISTS(snd_pcm_open "alsa/asoundlib.h" asound "" HAVE_LIBASOUND) - IF(HAVE_LIBASOUND OR HAVE_DLFCN_H OR WIN32) - SET(HAVE_ALSA 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) - IF(HAVE_DLFCN_H OR WIN32) - SET(BACKENDS "${BACKENDS} ALSA,") - ELSE() - SET(BACKENDS "${BACKENDS} ALSA \(linked\),") - SET(EXTRA_LIBS asound ${EXTRA_LIBS}) - ENDIF() +OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF) +FIND_PACKAGE(ALSA) +IF(ALSA_FOUND) + OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON) + IF(ALSOFT_BACKEND_ALSA) + SET(HAVE_ALSA 1) + SET_SOURCE_FILES_PROPERTIES(Alc/backends/alsa.c PROPERTIES + INCLUDE_DIRECTORIES "${ALSA_INCLUDE_DIRS}") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) + IF(HAVE_DLFCN_H OR WIN32) + SET(BACKENDS "${BACKENDS} ALSA,") + ELSE() + SET(BACKENDS "${BACKENDS} ALSA \(linked\),") + SET(EXTRA_LIBS ${ALSA_LIBRARIES} ${EXTRA_LIBS}) ENDIF() ENDIF() ENDIF() |