build: try to find optional libs

This commit is contained in:
Andrew Kelley 2015-07-02 15:55:11 -07:00
parent 1c8dcfcec5
commit b45bb06fac

View file

@ -24,32 +24,26 @@ else(Threads_FOUND)
endif(Threads_FOUND) endif(Threads_FOUND)
if(WIN32)
set(SOUNDIO_HAVE_PULSEAUDIO false)
set(STATUS_PULSEAUDIO "disabled")
else()
find_package(PulseAudio) find_package(PulseAudio)
if(PULSEAUDIO_FOUND) if(PULSEAUDIO_FOUND)
set(STATUS_PULSEAUDIO "OK") set(STATUS_PULSEAUDIO "OK")
set(SOUNDIO_HAVE_PULSEAUDIO true) set(SOUNDIO_HAVE_PULSEAUDIO true)
include_directories(${PULSEAUDIO_INCLUDE_DIR})
else() else()
set(STATUS_PULSEAUDIO "not found") set(STATUS_PULSEAUDIO "not found")
set(SOUNDIO_HAVE_PULSEAUDIO false) set(SOUNDIO_HAVE_PULSEAUDIO false)
endif() set(PULSEAUDIO_LIBRARY "")
endif() endif()
if(APPLE OR WIN32)
set(SOUNDIO_HAVE_ALSA false)
set(STATUS_ALSA "disabled")
else()
find_package(ALSA) find_package(ALSA)
if(ALSA_FOUND) if(ALSA_FOUND)
set(STATUS_ALSA "OK") set(STATUS_ALSA "OK")
set(SOUNDIO_HAVE_ALSA true) set(SOUNDIO_HAVE_ALSA true)
include_directories(${ALSA_INCLUDE_DIRS})
else() else()
set(STATUS_ALSA "not found") set(STATUS_ALSA "not found")
set(SOUNDIO_HAVE_ALSA false) set(SOUNDIO_HAVE_ALSA false)
endif() set(ALSA_LIBRARIES "")
endif() endif()
set(LIBSOUNDIO_SOURCES set(LIBSOUNDIO_SOURCES
@ -107,7 +101,6 @@ set_target_properties(libsoundio_shared PROPERTIES
) )
include_directories( include_directories(
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${PULSEAUDIO_INCLUDE_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${ALSA_INCLUDE_DIRS} ${ALSA_INCLUDE_DIRS}
) )