From d615c0f868f93c99a9fe4053b87594f6c8b2d39b Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Sun, 5 Feb 2017 02:39:44 +0100 Subject: [PATCH] cmake: Add imported target to FindALSA --- CMakeTests/FindALSA.cmake | 7 ++++++- Source/Core/AudioCommon/CMakeLists.txt | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeTests/FindALSA.cmake b/CMakeTests/FindALSA.cmake index fa9a43438b..86c1510287 100644 --- a/CMakeTests/FindALSA.cmake +++ b/CMakeTests/FindALSA.cmake @@ -39,7 +39,7 @@ if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h") unset(alsa_version_str) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR VERSION_VAR ALSA_VERSION_STRING) @@ -47,6 +47,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA if(ALSA_FOUND) set( ALSA_LIBRARIES ${ALSA_LIBRARY} ) set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} ) + add_library(ALSA::ALSA UNKNOWN IMPORTED) + set_target_properties(ALSA::ALSA PROPERTIES + IMPORTED_LOCATION ${ALSA_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIR} + ) endif() mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY) diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt index 51617eede9..63423667d1 100644 --- a/Source/Core/AudioCommon/CMakeLists.txt +++ b/Source/Core/AudioCommon/CMakeLists.txt @@ -15,9 +15,10 @@ 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_LIBRARIES}) + target_link_libraries(audiocommon PRIVATE ALSA::ALSA) endif() if(AO_FOUND)