summaryrefslogtreecommitdiffstats
path: root/Modules/FindOpenAL.cmake
diff options
context:
space:
mode:
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()