032365a
--- a/CMakeLists.txt
032365a
+++ b/CMakeLists.txt
032365a
@@ -45,7 +45,14 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_
032365a
 	endif()
032365a
 endif()
032365a
 
032365a
-cmake_minimum_required(VERSION 2.8)
032365a
+cmake_minimum_required(VERSION 3.5)
032365a
+
032365a
+# Prever LEGACY OpenGL to eb compatible with all the existing releases and
032365a
+# platforms which don't hare GLVND yet. Only do it if preference was not set
032365a
+# externally.
032365a
+if(NOT DEFINED OpenGL_GL_PREFERENCE)
032365a
+       set(OpenGL_GL_PREFERENCE "LEGACY")
032365a
+endif()
032365a
 
032365a
 if(NOT EXECUTABLE_OUTPUT_PATH)
032365a
 	set(FIRST_RUN TRUE)
032365a
@@ -987,7 +994,7 @@ if(WITH_SYSTEM_GLES)
032365a
 endif()
032365a
 
032365a
 if(WITH_GL_PROFILE_COMPAT OR WITH_GL_PROFILE_CORE)
032365a
-	list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_gl_LIBRARY}")
032365a
+	list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_LIBRARIES}")
032365a
 
032365a
 elseif(WITH_GL_PROFILE_ES20)
032365a
 	if(WITH_SYSTEM_GLES)