Commit a52d0db5328d89ba27be786b4fc81063f203db46

Ozkan Sezer 2021-03-04T18:28:10

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

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 322154c..9705785 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -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.