From fe9ec157fd0ea647452c4894209c4016fffac682 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 24 Dec 2020 07:34:29 -0800 Subject: Use an import target for linking OpenSL --- cmake/FindOpenSL.cmake | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'cmake') diff --git a/cmake/FindOpenSL.cmake b/cmake/FindOpenSL.cmake index e4b260bc..00428749 100644 --- a/cmake/FindOpenSL.cmake +++ b/cmake/FindOpenSL.cmake @@ -1,10 +1,9 @@ # - Find OpenSL # Find the OpenSL libraries # -# This module defines the following variables: -# OPENSL_FOUND - True if OPENSL_INCLUDE_DIR & OPENSL_LIBRARY are set -# OPENSL_INCLUDE_DIRS - where to find SLES/OpenSLES.h, etc. -# OPENSL_LIBRARIES - the OpenSL library +# This module defines the following variables and targets: +# OPENSL_FOUND - True if OPENSL was found +# OpenSL::OpenSLES - The OpenSLES target # #============================================================================= @@ -40,15 +39,12 @@ #============================================================================= find_path(OPENSL_INCLUDE_DIR NAMES SLES/OpenSLES.h - DOC "The OpenSL include directory" -) + DOC "The OpenSL include directory") find_path(OPENSL_ANDROID_INCLUDE_DIR NAMES SLES/OpenSLES_Android.h - DOC "The OpenSL Android include directory" -) + DOC "The OpenSL Android include directory") find_library(OPENSL_LIBRARY NAMES OpenSLES - DOC "The OpenSL library" -) + DOC "The OpenSL library") # handle the QUIETLY and REQUIRED arguments and set OPENSL_FOUND to TRUE if # all listed variables are TRUE @@ -57,8 +53,11 @@ find_package_handle_standard_args(OpenSL REQUIRED_VARS OPENSL_LIBRARY OPENSL_INC OPENSL_ANDROID_INCLUDE_DIR) if(OPENSL_FOUND) - set(OPENSL_LIBRARIES ${OPENSL_LIBRARY}) - set(OPENSL_INCLUDE_DIRS ${OPENSL_INCLUDE_DIR} ${OPENSL_ANDROID_INCLUDE_DIR}) + add_library(OpenSL::OpenSLES UNKNOWN IMPORTED) + set_target_properties(OpenSL::OpenSLES PROPERTIES + IMPORTED_LOCATION ${OPENSL_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${OPENSL_INCLUDE_DIR} + INTERFACE_INCLUDE_DIRECTORIES ${OPENSL_ANDROID_INCLUDE_DIR}) endif() mark_as_advanced(OPENSL_INCLUDE_DIR OPENSL_ANDROID_INCLUDE_DIR OPENSL_LIBRARY) -- cgit v1.2.3