Fix breakage of non-GLES2 setups (#8774)
authorJozef Behran <jozuejozef@gmail.com>
Sat, 10 Aug 2019 21:32:47 +0000 (23:32 +0200)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Sat, 10 Aug 2019 21:32:46 +0000 (23:32 +0200)
The commit 526a9e4b66abaf83eb6b1aaa3e93375acd87b830 breaks
the non-GLES2 setups because the code that is intended to
handle that is behind "elseif()" which is interpreted as
"elseif(false)" and thus the code never gets executed. Fix
that by changing the offending line to else().

Additionally, to avoid breaking the server only build
(which shall not have a dependency on GL/GLU/GLES at all),
enclose the entire block code in if(BUILD_CLIENT).

src/CMakeLists.txt

index 2627a0b97db95221919e4e9c561b9ed54a35ae31..ebf5b287179ec448cf9361d5d986b438bfff2b62 100644 (file)
@@ -104,15 +104,17 @@ endif()
 
 option(ENABLE_GLES "Use OpenGL ES instead of OpenGL" FALSE)
 mark_as_advanced(ENABLE_GLES)
-if(ENABLE_GLES)
-       find_package(OpenGLES2 REQUIRED)
-elseif()
-       if(NOT WIN32) # Unix probably
-               set(OPENGL_GL_PREFERENCE "LEGACY" CACHE STRING
-                       "See CMake Policy CMP0072 for reference. GLVND is broken on some nvidia setups")
-               set(OpenGL_GL_PREFERENCE ${OPENGL_GL_PREFERENCE})
-
-               find_package(OpenGL REQUIRED)
+if(BUILD_CLIENT)
+       if(ENABLE_GLES)
+               find_package(OpenGLES2 REQUIRED)
+       else()
+               if(NOT WIN32) # Unix probably
+                       set(OPENGL_GL_PREFERENCE "LEGACY" CACHE STRING
+                               "See CMake Policy CMP0072 for reference. GLVND is broken on some nvidia setups")
+                       set(OpenGL_GL_PREFERENCE ${OPENGL_GL_PREFERENCE})
+
+                       find_package(OpenGL REQUIRED)
+               endif()
        endif()
 endif()