summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74692d970..8482be6ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -249,7 +249,16 @@ if(NOT OPTION_DEDICATED)
link_package(Fontconfig TARGET Fontconfig::Fontconfig)
link_package(ICU_lx)
link_package(ICU_i18n)
- link_package(OpenGL TARGET OpenGL::GL)
+
+ if(SDL2_FOUND AND OPENGL_FOUND AND UNIX)
+ # SDL2 dynamically loads OpenGL if needed, so do not link to OpenGL when
+ # on Linux. For Windows, we need to link to OpenGL as we also have a win32
+ # driver using it.
+ add_definitions(-DWITH_OPENGL)
+ message(STATUS "OpenGL found -- -DWITH_OPENGL -- (via SDL2)")
+ else()
+ link_package(OpenGL TARGET OpenGL::GL)
+ endif()
endif()
if(APPLE)