FindOpenGL: Don't add AGL to OPENGL_LIBRARIES on OS X.

CMake had been setting OPENGL_glu_LIBRARY to AGL.framework, even
though AGL is not GLU.  AGL is simply the GL component for the
deprecated Carbon framework.  GLU is provided by OpenGL.framework.

A side effect of the old behavior was that if AGL was not found
(it is absent from OS X SDK 10.10 or later), then OPENGL_GLU_FOUND
would be incorrectly set to "NO".
This commit is contained in:
David Gobbi 2015-12-12 09:32:42 -07:00 committed by Brad King
parent a680211ca7
commit 08580be2ad
1 changed files with 8 additions and 4 deletions

View File

@ -71,9 +71,11 @@ elseif (WIN32)
elseif (APPLE) elseif (APPLE)
find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") # The OpenGL.framework provides both gl and glu
find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X")
find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") 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")
list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
else() else()
@ -149,7 +151,9 @@ if(OPENGL_gl_LIBRARY)
set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
if(OPENGL_glu_LIBRARY) if(OPENGL_glu_LIBRARY)
set( OPENGL_GLU_FOUND "YES" ) set( OPENGL_GLU_FOUND "YES" )
if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}")
set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
endif()
else() else()
set( OPENGL_GLU_FOUND "NO" ) set( OPENGL_GLU_FOUND "NO" )
endif() endif()