diff options
author | Brad King <brad.king@kitware.com> | 2016-12-06 14:26:25 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-12-06 14:26:25 (GMT) |
commit | 0f37cd228e9668d981ff75f3e1c63d4f716b7e57 (patch) | |
tree | 72b1096688d66b1a081a07d15cacba3261708978 /Tests | |
parent | 0290bfc35dee73fb534556700554536f1164caaf (diff) | |
parent | 027ce359ff7454ac0aca4d9a9208759ef4b9c8b7 (diff) | |
download | CMake-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.txt | 4 | ||||
-rw-r--r-- | Tests/FindOpenGL/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindOpenGL/Test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindOpenGL/Test/main.c | 17 |
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; +} |