From 2fceb016b495b30eceb65b35cde058e773d8de49 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Sun, 5 Feb 2017 02:44:03 +0100 Subject: [PATCH] cmake: Move ALSA detection to AudioCommon --- CMakeLists.txt | 13 ------------- Source/Core/AudioCommon/CMakeLists.txt | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6d82b0d65..091feb451e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt index 63423667d1..c5b58c23be 100644 --- a/Source/Core/AudioCommon/CMakeLists.txt +++ b/Source/Core/AudioCommon/CMakeLists.txt @@ -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)