Merge topic 'fix-opengl-legacy' into release-4.4

69956c6f63 FindOpenGL: Fix OpenGL and GLX result variables with legacy GL

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12205
This commit is contained in:
Brad King
2026-06-23 09:55:23 -04:00

View File

@@ -529,12 +529,6 @@ else()
list(APPEND _OpenGL_CACHE_VARS OPENGL_gl_LIBRARY)
endif()
# When preferring legacy, linking OpenGL and GLX should behave the same as linking legacy GL.
if(OpenGL_GL_PREFERENCE STREQUAL "LEGACY")
set(OpenGL_glx_LIBRARY "${OPENGL_gl_LIBRARY}")
set(OpenGL_opengl_LIBRARY "${OPENGL_gl_LIBRARY}")
endif()
if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY)
cmake_policy(ISSUE_WARNING CMP0072 POST
"FindOpenGL found both a legacy GL library:\n"
@@ -548,6 +542,12 @@ else()
endif()
unset(_OpenGL_GL_POLICY_WARN)
# When preferring legacy, linking OpenGL and GLX should behave the same as linking legacy GL.
if(OpenGL_GL_PREFERENCE STREQUAL "LEGACY")
set(OPENGL_glx_LIBRARY "${OPENGL_gl_LIBRARY}")
set(OPENGL_opengl_LIBRARY "${OPENGL_gl_LIBRARY}")
endif()
# FPHSA cannot handle "this OR that is required", so we conditionally set what
# it must look for. First clear any previous config we might have done:
set(_OpenGL_REQUIRED_VARS)