diff options
author | nega <1098-nega@users.noreply.gitlab.kitware.com> | 2023-03-28 22:47:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-29 17:31:48 (GMT) |
commit | 5f5476ee315ffdaedc37115d2d7049f4f3f2f05d (patch) | |
tree | 592b8bd2fc4af2ca04314100cdab8cf6aa2f350a /Modules | |
parent | f4b8176447699ba82c2bf7baf2d609d0d6e3259b (diff) | |
download | CMake-5f5476ee315ffdaedc37115d2d7049f4f3f2f05d.zip CMake-5f5476ee315ffdaedc37115d2d7049f4f3f2f05d.tar.gz CMake-5f5476ee315ffdaedc37115d2d7049f4f3f2f05d.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindOpenAL.cmake | 22 |
1 files 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() |