Using X with GL and APPLE
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Building on APPLE with VTK_USE_X requires that the user manually set OPENGL_gl_LIBRARY, OPENGL_glu_LIBRARY, and OPENGL_INCLUDE_DIR.
This tidbit of inforrmation is burried in the comment at the top of ${CMAKE_ROOT}/Modules/FindOpenGL.cmake. The build goes OK for quite awhile until the Rendering directory starts building, and then the compiler can not find "GL/gl.h" and it breaks.
The following patch makes CMAKE issue an error if these variables are not set. This let's the end user know upfront what the problem is and how to fix it.
=================================================================== RCS file: /cvsroot/VTK/VTK/CMakeLists.txt,v retrieving revision 1.385 diff -r1.385 CMakeLists.txt 1031,1033c1031,1044 < IF(VTK_USE_RENDERING) < INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake) < ENDIF(VTK_USE_RENDERING)
> IF(VTK_USE_X AND APPLE) > IF( NOT OPENGL_gl_LIBRARY OR NOT OPENGL_glu_LIBRARY OR NOT OPENGL_INCLUDE_DIR ) > MESSAGE(SEND_ERROR "USE OF X on APPLE requires manual setting of OPENGL_gl_LIBRARY, OPENGL_glu_LIBRARY, and OPENGL_INCLUDE_DIR." > "You may want to try:" > "-DOPENGL_gl_LIBRARY:STRING=/usr/X11R6/lib/libGL.a" > "-DOPENGL_glu_LIBRARY:STRING=/usr/X11R6/lib/libGLU.a" > "-DOPENGL_INCLUDE_DIR:STRING=/usr/X11R6/include" > ) > ENDIF( NOT OPENGL_gl_LIBRARY OR NOT OPENGL_glu_LIBRARY OR NOT OPENGL_INCLUDE_DIR ) > ELSE(VTK_USE_X AND APPLE) > IF(VTK_USE_RENDERING) > INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake) > ENDIF(VTK_USE_RENDERING) > ENDIF(VTK_USE_X AND APPLE)