Commit cfa76973ff446b3f9a9909be90a140edf3566e42

Anonymous Maarten 2022-11-01T11:33:39

cmake: FindOpenGL.cmake shipped by emscripten does not have OpenGL::GL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d89be52..f358b03 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -226,8 +226,14 @@ if(SDL_DUMMYVIDEO)
 endif()
 
 if(OPENGL_FOUND)
-    target_link_libraries(testshader OpenGL::GL)
-    target_link_libraries(testgl2 OpenGL::GL)
+    if(TARGET OpenGL::GL)
+        target_link_libraries(testshader OpenGL::GL)
+        target_link_libraries(testgl2 OpenGL::GL)
+    else()
+        # emscripten's FindOpenGL.cmake does not create OpenGL::GL
+        target_link_libraries(testshader ${OPENGL_gl_LIBRARY})
+        target_link_libraries(testgl2 ${OPENGL_gl_LIBRARY})
+    endif()
 endif()
 
 file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt)