[vtk-developers] Re: [vtkusers] Re: Fwd: Re: Compiling VTK-5.0.2 with Cygwin make

David Cole david.cole at kitware.com
Thu Sep 21 16:03:33 EDT 2006


Seems to me that FindOpenGL should always give you one of two things:
- OpenGL not found ... or
- a complete set of OPENGL_* CMake settings that are self-consistent

The fact that OPENGL_INCLUDE_DIR was pulling in an include file that 
differed from the library chosen for linking indicates that FindOpenGL 
sometimes gives inconsistent CMake settings... So. That's one bug to be 
fixed. Volunteers?

I could be wrong, but I'm pretty sure WIN32 is *always* defined on 
Windows CMake, even under cygwin. You are using the cygwin cmake, right? 
("which cmake" from your cygwin prompt should report "/usr/bin/cmake" as 
opposed to the one installed in program files...)

You can verify that CMake goes through a certain path by using this 
"print it" debugging technique:
IF(WIN32)
  MESSAGE(STATUS "WIN32 is defined...")
ELSE(WIN32)
  MESSAGE(STATUS "boo hoo - no WIN32...")
ENDIF(WIN32)
(You can edit FindOpenGL.cmake and stick some messages in it to see 
which control paths are followed...)


HTH,
David


Steve Robbins wrote:

> Quoting Steve Robbins <smr at sumost.ca>:
>
> To recap: I am building VTK 5 sources on cygwin under windows XP.  
> The  initial build failed with link errors.  Cygwin provides two 
> different  OpenGL implementations: one that runs on top of X11 and one 
> that  doesn't.  The cause of the link errors is that the compilation 
> used  gl.h from X11 but linked against the non-X11 GL library.
>
> I configured with VTK_USE_X set to OFF.
>
>
>> Note that VTK_USE_X is off: so why am I picking up
>> -I/usr/X11R6/include?  Hmmm....
>
>
> The answer is that CMakeCache.txt had the following line:
> OPENGL_INCLUDE_DIR:PATH=/usr/X11R6/include
>
> So why is that?  It appears to me that there's a bug somewhere in  
> CMake (I'm using  CMake version 2.4-patch 3).  There's no agreement 
> on  whether having CYGWIN true should imply that WIN32 is true.  The  
> symbol CYGWIN is set by the CMakeCCompiler, CMakeCXXCompiler, and  
> CMakeFortranCompiler.  All of these set UNIX but don't set WIN32.  
> The  module FindOpenGL, however, only tests CYGWIN when WIN32 is also 
> true.
>
> In particular, here is the code from FindOpenGL that searches for the  
> OpenGL include path:
>
> IF (WIN32)
>   IF (CYGWIN)
>
>     FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
>       /usr/include
>       /usr/include/w32api
>       /usr/X11R6/include
>     )
> [...]
> ELSE (WIN32)
>   IF(NOT APPLE)
>
>   FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
>     /usr/share/doc/NVIDIA_GLX-1.0/include
>     /usr/include
>     /usr/local/include
>     /usr/openwin/share/include
>     /opt/graphics/OpenGL/include
>     /usr/X11R6/include
>   )
> [...]
>
>
> For non-X11 builds, the correct location for GL/gl.h is  
> /usr/include/w32api.  But since WIN32 is not defined, we go through  
> the second FIND_PATH() and end up with -I/usr/X11R6/include on the  
> compilation.
>
> I'm not really sure what to suggest as a fix: should CMakeCCompiler  
> and friends define WIN32 or should FindOpenGL be overhauled?
>
> -Steve
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtk-developers mailing list