From 69956c6f63dcae7d28029c85143ba447eb02f182 Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Mon, 22 Jun 2026 08:57:42 -0400 Subject: [PATCH] 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 --- Modules/FindOpenGL.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 6362edf2e4..1aa64fd31c 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -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)