FindOpenGL: Document how to use macOS X11 OpenGL

Dicourse-topic: https://discourse.cmake.org/t/9466
This commit is contained in:
Randolph M. Fritz 2023-12-09 17:35:08 -08:00 committed by Brad King
parent a13f62427b
commit 1dbfe638da

View File

@ -177,9 +177,24 @@ GLVND. For non-GLVND Linux and other systems these are left undefined.
macOS-Specific
^^^^^^^^^^^^^^
On OSX FindOpenGL defaults to using the framework version of OpenGL. People
will have to change the cache values of OPENGL_glu_LIBRARY and
OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
On macOS this module defaults to using the macOS-native framework
version of OpenGL. To use the X11 version of OpenGL on macOS, one
can disable searching of frameworks. For example:
.. code-block:: cmake
find_package(X11)
if(APPLE AND X11_FOUND)
set(CMAKE_FIND_FRAMEWORK NEVER)
find_package(OpenGL)
unset(CMAKE_FIND_FRAMEWORK)
else()
find_package(OpenGL)
endif()
An end user building this project may need to point CMake at their
X11 installation, e.g., with ``-DOpenGL_ROOT=/opt/X11``.
#]=======================================================================]
set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY)