summaryrefslogtreecommitdiff
path: root/Tests/FindOpenAL/Test
diff options
context:
space:
mode:
authorSam V <sam.vanheer@outlook.com>2022-06-21 17:26:31 +0200
committerBrad King <brad.king@kitware.com>2022-06-22 09:16:19 -0400
commit927e091949baf4e9627f48444a90191780501cc4 (patch)
treefde483c4fd335b28c9090a75160f8f0793092e4a /Tests/FindOpenAL/Test
parent2f3ea66a76cc475a6742d2ed00d9eeadbbaff13e (diff)
downloadcmake-927e091949baf4e9627f48444a90191780501cc4.tar.gz
FindOpenAL: Add imported target
Fixes: #20026
Diffstat (limited to 'Tests/FindOpenAL/Test')
-rw-r--r--Tests/FindOpenAL/Test/CMakeLists.txt14
-rw-r--r--Tests/FindOpenAL/Test/main.cxx13
2 files changed, 27 insertions, 0 deletions
diff --git a/Tests/FindOpenAL/Test/CMakeLists.txt b/Tests/FindOpenAL/Test/CMakeLists.txt
new file mode 100644
index 0000000000..fa3e2638ee
--- /dev/null
+++ b/Tests/FindOpenAL/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.21)
+project(TestFindOpenAL CXX)
+include(CTest)
+
+find_package(OpenAL REQUIRED)
+
+add_executable(test_tgt main.cxx)
+target_link_libraries(test_tgt OpenAL::OpenAL)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.cxx)
+target_include_directories(test_var PRIVATE ${OPENAL_INCLUDE_DIR})
+target_link_libraries(test_var PRIVATE ${OPENAL_LIBRARY})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindOpenAL/Test/main.cxx b/Tests/FindOpenAL/Test/main.cxx
new file mode 100644
index 0000000000..bb45faf5b9
--- /dev/null
+++ b/Tests/FindOpenAL/Test/main.cxx
@@ -0,0 +1,13 @@
+#include <AL/al.h>
+#include <AL/alc.h>
+#include <stdio.h>
+
+int main()
+{
+ /* Reference an AL symbol without requiring a context at runtime. */
+ printf("&alGetString = %p\n", &alGetString);
+
+ /* Reference an ALC symbol without requiring a context at runtime. */
+ printf("&alcGetString = %p\n", &alcGetString);
+ return 0;
+}