mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 18:51:05 -05:00
027ce359ff
Create OpenGL::GL and OpenGL::GLU imported targets using the locations found. This feature was originally added by commit v3.1.0-rc1~420^2~2 (FindOpenGL: Provide imported targets for GL and GLU, 2014-05-31) but had to be reverted by commit v3.1.0-rc3~10^2 (FindOpenGL: Revert support for imported targets, 2014-12-01) due to issue #15267. Since then we added support for `IMPORTED_LIBNAME` to interface libraries, so use it to handle the case where we have only the library name without an absolute path. Inspired-by: Philipp Möller <bootsarehax@googlemail.com> Closes: #15267
15 lines
428 B
CMake
15 lines
428 B
CMake
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)
|