Skip to content

FindOpenGL: Default to non-GLVND libraries for legacy GL

Brad King requested to merge brad.king/cmake:FindOpenGL-no-glvnd-for-GL into master

Projects using OPENGL_LIBRARIES or OpenGL::GL expect legacy GL. Although GLVND OpenGL+GLX provides legacy GL interfaces, using those library files may conflict with legacy GL library files used by dependencies (or dependents) of such projects. Therefore we should not use OpenGL+GLX when a legacy GL library is available.

If OPENGL_gl_LIBRARY is set then use it as the legacy GL library. If it is not set then fall back to using GLVND OpenGL+GLX to provide legacy GL interface. This will allow users to build projects using GLVND even if they have not been ported.

Fixes: #17437 (closed)

Merge request reports