[cmake-developers] [PATCH] FindALSA: Create an imported ALSA:ASound target

Brad King brad.king at kitware.com
Tue Jan 19 14:27:04 EST 2016


On 01/19/2016 11:50 AM, Sam Thursfield wrote:
> Imported targets are now the recommended way of dealing with external
> library dependencies.

Thanks!  Adding Roger Leigh to Cc because he has implemented several
of these for other modules.

> +  set(ALSA_LIBRARIES ${ALSA_LIBRARY})
> +  set(ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR})
> +
> +  if(NOT TARGET ALSA::ASound)
> +    add_library(ALSA::ASound UNKNOWN IMPORTED)
> +    set_target_properties(ALSA::ASound PROPERTIES
> +      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
> +      IMPORTED_LOCATION "${ALSA_LIBRARY}"
> +      INTERFACE_INCLUDE_DIRECTORIES "${ALSA_INCLUDE_DIRS}"
> +      INTERFACE_LIBRARIES "${ALSA_LIBRARY}"

We shouldn't need to use INTERFACE_LIBRARIES here.  The IMPORTED_LOCATION
of an imported library should be enough to get it linked.

-Brad



More information about the cmake-developers mailing list