summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-06 14:26:25 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-12-06 14:26:25 (GMT)
commit0f37cd228e9668d981ff75f3e1c63d4f716b7e57 (patch)
tree72b1096688d66b1a081a07d15cacba3261708978 /Tests
parent0290bfc35dee73fb534556700554536f1164caaf (diff)
parent027ce359ff7454ac0aca4d9a9208759ef4b9c8b7 (diff)
downloadCMake-0f37cd228e9668d981ff75f3e1c63d4f716b7e57.zip
CMake-0f37cd228e9668d981ff75f3e1c63d4f716b7e57.tar.gz
CMake-0f37cd228e9668d981ff75f3e1c63d4f716b7e57.tar.bz2
Merge topic 'FindOpenGL-imported-targets'
027ce359 FindOpenGL: Provide imported targets for GL and GLU
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindOpenGL/CMakeLists.txt10
-rw-r--r--Tests/FindOpenGL/Test/CMakeLists.txt14
-rw-r--r--Tests/FindOpenGL/Test/main.c17
4 files changed, 45 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index fa5f3e8..73eef9a 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1400,6 +1400,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindOpenCL)
endif()
+ if(CMake_TEST_FindOpenGL)
+ add_subdirectory(FindOpenGL)
+ endif()
+
if(CMake_TEST_FindOpenSSL)
add_subdirectory(FindOpenSSL)
endif()
diff --git a/Tests/FindOpenGL/CMakeLists.txt b/Tests/FindOpenGL/CMakeLists.txt
new file mode 100644
index 0000000..9aa3aba
--- /dev/null
+++ b/Tests/FindOpenGL/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindOpenGL.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindOpenGL/Test"
+ "${CMake_BINARY_DIR}/Tests/FindOpenGL/Test"
+ ${build_generator_args}
+ --build-project TestFindOpenGL
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindOpenGL/Test/CMakeLists.txt b/Tests/FindOpenGL/Test/CMakeLists.txt
new file mode 100644
index 0000000..cac3424
--- /dev/null
+++ b/Tests/FindOpenGL/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.7)
+project(TestFindOpenGL C)
+include(CTest)
+
+find_package(OpenGL REQUIRED)
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt OpenGL::GLU)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${OPENGL_INGLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${OPENGL_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindOpenGL/Test/main.c b/Tests/FindOpenGL/Test/main.c
new file mode 100644
index 0000000..bca3d7e
--- /dev/null
+++ b/Tests/FindOpenGL/Test/main.c
@@ -0,0 +1,17 @@
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
+#include <GL/gl.h>
+#endif
+
+#include <stdio.h>
+
+int main()
+{
+ /* Reference a GL symbol without requiring a context at runtime. */
+ printf("&glGetString = %p\n", &glGetString);
+ return 0;
+}