diff options
author | Brad King <brad.king@kitware.com> | 2023-12-12 13:43:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-12-12 13:43:25 (GMT) |
commit | 84a3e839ec94723d286358bc69f4dada4436e975 (patch) | |
tree | 235a40675994f1862f95e668ebed5ffd2dc42fde /Modules | |
parent | 9642647646d02be7457c8af86bee51a72740b692 (diff) | |
parent | 1dbfe638da55b181ce9c0897d52becc680d02b64 (diff) | |
download | CMake-84a3e839ec94723d286358bc69f4dada4436e975.zip CMake-84a3e839ec94723d286358bc69f4dada4436e975.tar.gz CMake-84a3e839ec94723d286358bc69f4dada4436e975.tar.bz2 |
Merge topic 'FindOpenGL-macOS-x11'
1dbfe638da FindOpenGL: Document how to use macOS X11 OpenGL
a13f62427b FindOpenGL: Clarify cache entry doc strings on macOS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9062
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindOpenGL.cmake | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 1527c31..5c4839c 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -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) @@ -207,11 +222,14 @@ if (WIN32) OPENGL_glu_LIBRARY ) elseif (APPLE) - # The OpenGL.framework provides both gl and glu - find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X") - find_library(OPENGL_glu_LIBRARY OpenGL DOC - "GLU library for OS X (usually same as OpenGL library)") - find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X") + # The OpenGL.framework provides both gl and glu in OpenGL + # XQuartz provides libgl and libglu + find_library(OPENGL_gl_LIBRARY NAMES OpenGL GL DOC + "OpenGL GL library") + find_library(OPENGL_glu_LIBRARY NAMES OpenGL GLU DOC + "OpenGL GLU library") + find_path(OPENGL_INCLUDE_DIR NAMES OpenGL/gl.h GL/gl.h DOC + "Include for OpenGL") list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) list(APPEND _OpenGL_CACHE_VARS |