summaryrefslogtreecommitdiffstats
path: root/Modules/FindOpenAL.cmake
diff options
context:
space:
mode:
authorSam V <sam.vanheer@outlook.com>2022-06-21 15:26:31 (GMT)
committerBrad King <brad.king@kitware.com>2022-06-22 13:16:19 (GMT)
commit927e091949baf4e9627f48444a90191780501cc4 (patch)
treefde483c4fd335b28c9090a75160f8f0793092e4a /Modules/FindOpenAL.cmake
parent2f3ea66a76cc475a6742d2ed00d9eeadbbaff13e (diff)
downloadCMake-927e091949baf4e9627f48444a90191780501cc4.zip
CMake-927e091949baf4e9627f48444a90191780501cc4.tar.gz
CMake-927e091949baf4e9627f48444a90191780501cc4.tar.bz2
FindOpenAL: Add imported target
Fixes: #20026
Diffstat (limited to 'Modules/FindOpenAL.cmake')
-rw-r--r--Modules/FindOpenAL.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index b5b92c5..53aafdc 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -29,6 +29,16 @@ OpenAL is searched in the following order:
5. Manually compiled framework: ``/Library/Frameworks``.
6. Add-on package: ``/opt``.
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.25
+
+This module defines the :prop_tgt:`IMPORTED` target:
+
+``OpenAL::OpenAL``
+ The OpenAL library, if found.
+
Result Variables
^^^^^^^^^^^^^^^^
@@ -94,3 +104,19 @@ 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()
+ set_target_properties(OpenAL::OpenAL PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}")
+ endif()
+endif()