[Cmake] CMake always links X11 OpenGL on MacOS X

Chris Scharver scharver at evl.uic.edu
Tue, 10 Feb 2004 08:05:21 -0600


On Feb 10, 2004, at 7:43 AM, William A. Hoffman wrote:

> I am not sure what is wrong, but the FindOpenGL.cmake from 1.8.3 should
> look like this:
>
> # On OSX default 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

I'm trying to let the user use a GUI for choosing X11. The file dialogs 
make it easier to navigate to XFree86 install locations. (This is 
helpful if they're not in one of the standard locations.) Since the 
value types are strings, the dialogs are not available. There may not 
be any way to work around this for the time being.

> IF (APPLE)
>   SET (OPENGL_gl_LIBRARY "-framework OpenGL" CACHE STRING "OpenGL lib 
> for OSX")
>   SET (OPENGL_glu_LIBRARY "-framework AGL" CACHE STRING "AGL lib for 
> OSX")
> ENDIF (APPLE)
>
> It should prefer the Cocoa over X11.

That's correct, but the X11 libraries are still linked into executables 
if X11 is present on the system, regardless of whether it is 
specifically requested. That's what I'm trying to avoid. The problem is 
that SET (OPENGL_LIBRARIES ${X11_LIBRARIES}) is used anytime X11 is 
found on the system. This shouldn't happen for MacOS X unless the 
target is specifically compiling for X11. Likewise, I set 
OPENGL_INCLUDE_DIR so that it's not the X11 include path, but rather 
the location of the OpenGL.framework.

> Where did you get this CMake 1.8.3-1?

That was a typo on my part. It's CMake 1.8.3. No -1 on it. One file 
still had a 1.8.2-1 header. The FindOpenGL.cmake modifications are 
mine.

Chris
--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www.evl.uic.edu/scharver/>