[vtk-developers] Re: Fwd: Re: Compiling VTK-5.0.2 with Cygwin make
Steve Robbins
smr at sumost.ca
Thu Sep 21 15:37:33 EDT 2006
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
More information about the vtk-developers
mailing list