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) find_package(PulseAudio)
set(SOUNDIO_HAVE_PULSEAUDIO false) if(PULSEAUDIO_FOUND)
set(STATUS_PULSEAUDIO "disabled") set(STATUS_PULSEAUDIO "OK")
set(SOUNDIO_HAVE_PULSEAUDIO true)
include_directories(${PULSEAUDIO_INCLUDE_DIR})
else() else()
find_package(PulseAudio) set(STATUS_PULSEAUDIO "not found")
if(PULSEAUDIO_FOUND) set(SOUNDIO_HAVE_PULSEAUDIO false)
set(STATUS_PULSEAUDIO "OK") set(PULSEAUDIO_LIBRARY "")
set(SOUNDIO_HAVE_PULSEAUDIO true)
else()
set(STATUS_PULSEAUDIO "not found")
set(SOUNDIO_HAVE_PULSEAUDIO false)
endif()
endif() endif()
if(APPLE OR WIN32) find_package(ALSA)
set(SOUNDIO_HAVE_ALSA false) if(ALSA_FOUND)
set(STATUS_ALSA "disabled") set(STATUS_ALSA "OK")
set(SOUNDIO_HAVE_ALSA true)
include_directories(${ALSA_INCLUDE_DIRS})
else() else()
find_package(ALSA) set(STATUS_ALSA "not found")
if(ALSA_FOUND) set(SOUNDIO_HAVE_ALSA false)
set(STATUS_ALSA "OK") set(ALSA_LIBRARIES "")
set(SOUNDIO_HAVE_ALSA true)
else()
set(STATUS_ALSA "not found")
set(SOUNDIO_HAVE_ALSA false)
endif()
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}
) )