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)