cmake: Move ALSA detection to AudioCommon

This commit is contained in:
Florent Castelli 2017-02-05 02:44:03 +01:00
parent d615c0f868
commit 2fceb016b4
2 changed files with 12 additions and 17 deletions

View File

@ -434,19 +434,6 @@ if (OPENGL_GL)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(ENABLE_ALSA)
find_package(ALSA)
if(ALSA_FOUND)
add_definitions(-DHAVE_ALSA=1)
message(STATUS "ALSA found, enabling ALSA sound backend")
else()
add_definitions(-DHAVE_ALSA=0)
message(STATUS "ALSA NOT found, disabling ALSA sound backend")
endif()
else()
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend")
endif()
if(ENABLE_AO)
check_lib(AO ao ao QUIET)
if(AO_FOUND)

View File

@ -15,10 +15,18 @@ if(OPENSLES_FOUND)
target_link_libraries(audiocommon PRIVATE OpenSLES::OpenSLES)
endif()
find_package(ALSA)
if(ALSA_FOUND)
target_sources(audiocommon PRIVATE AlsaSoundStream.cpp)
target_link_libraries(audiocommon PRIVATE ALSA::ALSA)
if(ENABLE_ALSA)
find_package(ALSA)
if(ALSA_FOUND)
message(STATUS "ALSA found, enabling ALSA sound backend")
target_sources(audiocommon PRIVATE AlsaSoundStream.cpp)
target_link_libraries(audiocommon PRIVATE ALSA::ALSA)
target_compile_definitions(audiocommon PRIVATE HAVE_ALSA=1)
else()
message(STATUS "ALSA NOT found, disabling ALSA sound backend")
endif()
else()
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend")
endif()
if(AO_FOUND)