Merge branch 'blender2.7'
[blender.git] / CMakeLists.txt
index c40eb5bb2a0ec51a09057efa2081549e00413298..faa5edec810dca7a7eb3e1aa68fe143320b975d0 100644 (file)
@@ -47,6 +47,13 @@ endif()
 
 cmake_minimum_required(VERSION 3.5)
 
 
 cmake_minimum_required(VERSION 3.5)
 
+# Prever LEGACY OpenGL to eb compatible with all the existing releases and
+# platforms which don't hare GLVND yet. Only do it if preference was not set
+# externally.
+if(NOT DEFINED OpenGL_GL_PREFERENCE)
+       set(OpenGL_GL_PREFERENCE "LEGACY")
+endif()
+
 if(NOT EXECUTABLE_OUTPUT_PATH)
        set(FIRST_RUN TRUE)
 else()
 if(NOT EXECUTABLE_OUTPUT_PATH)
        set(FIRST_RUN TRUE)
 else()
@@ -1050,8 +1057,11 @@ if(WITH_GL_PROFILE_ES20)
        endif()
 
 else()
        endif()
 
 else()
-       list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_gl_LIBRARY}")
-
+       if(OpenGL_GL_PREFERENCE STREQUAL "LEGACY" AND OPENGL_gl_LIBRARY)
+               list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_gl_LIBRARY})
+       else()
+               list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY})
+       endif()
 endif()
 
 if(WITH_GL_EGL)
 endif()
 
 if(WITH_GL_EGL)