From 5f5476ee315ffdaedc37115d2d7049f4f3f2f05d Mon Sep 17 00:00:00 2001 From: nega <1098-nega@users.noreply.gitlab.kitware.com> Date: Tue, 28 Mar 2023 18:47:25 -0400 Subject: FindOpenAL: Fix imported target for macOS framework If a framework is found, specify it through `INTERFACE_LINK_LIBRARIES` because `IMPORTED_LOCATION` requires a file and not a framework directory. --- Modules/FindOpenAL.cmake | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 53aafdc..3d58569 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -105,18 +105,16 @@ find_package_handle_standard_args( mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) -if(OPENAL_INCLUDE_DIR AND OPENAL_LIBRARY) - if(NOT TARGET OpenAL::OpenAL) - if(EXISTS "${OPENAL_LIBRARY}") - add_library(OpenAL::OpenAL UNKNOWN IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - IMPORTED_LOCATION "${OPENAL_LIBRARY}") - else() - add_library(OpenAL::OpenAL INTERFACE IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - IMPORTED_LIBNAME "${OPENAL_LIBRARY}") - endif() +if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL) + if(OPENAL_LIBRARY MATCHES "/([^/]+)\\.framework$") + add_library(OpenAL::OpenAL INTERFACE IMPORTED) set_target_properties(OpenAL::OpenAL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}") + INTERFACE_LINK_LIBRARIES "${OPENAL_LIBRARY}") + else() + add_library(OpenAL::OpenAL UNKNOWN IMPORTED) + set_target_properties(OpenAL::OpenAL PROPERTIES + IMPORTED_LOCATION "${OPENAL_LIBRARY}") endif() + set_target_properties(OpenAL::OpenAL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}") endif() -- cgit v0.12