From 1c87844856f7995bccc30c32567540be948f80da Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 28 May 2018 15:47:23 +0200 Subject: FindALSA: provide an imported target --- Help/release/dev/alsa-target.rst | 4 ++++ Modules/FindALSA.cmake | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 Help/release/dev/alsa-target.rst diff --git a/Help/release/dev/alsa-target.rst b/Help/release/dev/alsa-target.rst new file mode 100644 index 0000000..e970580 --- /dev/null +++ b/Help/release/dev/alsa-target.rst @@ -0,0 +1,4 @@ +alsa-target +----------- + +* The :module:`FindALSA` module now provides imported targets. diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index fa9a434..84b6ec5 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -9,6 +9,15 @@ # # Find the alsa libraries (asound) # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if +# ALSA has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# # :: # # This module defines the following variables: @@ -47,6 +56,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) -- cgit v0.12