diff options
Diffstat (limited to 'Modules/FindALSA.cmake')
-rw-r--r-- | Modules/FindALSA.cmake | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index fa9a43438..c9cfd60ff 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -9,20 +9,36 @@ # # Find the alsa libraries (asound) # -# :: +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ # -# This module defines the following variables: -# ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found -# ALSA_LIBRARIES - Set when ALSA_LIBRARY is found -# ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found +# This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if +# ALSA has been found. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module defines the following variables: # -# :: +# ``ALSA_FOUND`` +# True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found # -# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc. -# ALSA_LIBRARY - the asound library -# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8) +# ``ALSA_LIBRARIES`` +# List of libraries when using ALSA. +# +# ``ALSA_INCLUDE_DIRS`` +# Where to find the ALSA headers. +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``ALSA_INCLUDE_DIR`` +# the ALSA include directory +# +# ``ALSA_LIBRARY`` +# the absolute path of the asound library find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h DOC "The ALSA (asound) include directory" @@ -47,6 +63,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA if(ALSA_FOUND) set( ALSA_LIBRARIES ${ALSA_LIBRARY} ) set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} ) + if(NOT TARGET ALSA::ALSA) + add_library(ALSA::ALSA UNKNOWN IMPORTED) + set_target_properties(ALSA::ALSA PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ALSA_INCLUDE_DIRS}") + set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION "${ALSA_LIBRARY}") + endif() endif() mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY) |