FindOpenGL: Fix OpenGL and GLX result variables with legacy GL

In commit 32a5f11e50 (FindOpenGL: respect legacy preference for OpenGL
and GLX libraries, 2025-10-31, v4.3.0-rc1~544^2) the result variables
were spelled incorrectly.  Also re-order logic to preserve the CMP0072
warning text naming the GLVND libraries.

Fixes: #27299
This commit is contained in:
Carlo Bramini
2026-06-22 20:05:04 -04:00
committed by Brad King
parent c9629f9f16
commit 69956c6f63
+6 -6
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(GET_WARNING CMP0072 _cmp0072_warning)
message(AUTHOR_WARNING
@@ -550,6 +544,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)