test/CMakeLists.txt: add OpenGL module checks and adjust dependencies.

from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
main
Ozkan Sezer 2021-03-04 18:28:10 +03:00
parent e7abf96801
commit a52d0db532
1 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,12 @@ if(WINDOWS)
add_definitions(-Dmain=SDL_main)
endif()
find_package(OpenGL)
if (OPENGL_FOUND)
add_definitions(-DHAVE_OPENGL)
endif()
add_executable(checkkeys checkkeys.c)
add_executable(loopwave loopwave.c)
add_executable(loopwavequeue loopwavequeue.c)
@ -88,6 +94,13 @@ add_executable(controllermap controllermap.c)
add_executable(testvulkan testvulkan.c)
add_executable(testoffscreen testoffscreen.c)
if(OPENGL_FOUND)
add_dependencies(testshader OpenGL::GL)
add_dependencies(testgl2 OpenGL::GL)
target_link_libraries(testshader OpenGL::GL)
target_link_libraries(testgl2 OpenGL::GL)
endif()
# HACK: Dummy target to cause the resource files to be copied to the build directory.
# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression.
# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode.