[vtkusers] Newbie: compiling Cone1.cxx using installed VTK

Atwood, Robert C r.atwood at imperial.ac.uk
Thu Nov 23 14:16:43 EST 2006


I am unabel to compile Cone1.cxx using the installed VTK, though it
works if I point at the build tree instead of the installed tree. What
have I done wrong with the installation, or how should CMakeLists.txt be
modified to build just one example in my own home directory, using the
installed VTK files? Why should it try to load the cache for the build,
I don't see where in CMakeLists.txt this is requested.


I've used ITK happily with basic CmakeLists.txt from the examples for
some time and not encountered such a problem. Also, to gripe a bit, the
'help' for the VTK_DIR option says:

 Current option is: VTK_DIR
 Help string for this option is: The directory containing
VTKConfig.cmake.
 This is either the root of the build tree, or PREFIX/lib/vtk for an
 installation.  For VTK 4.0, this is the location of UseVTK.cmake.  This
is
 either the root of the build tree or PREFIX/include/vtk for an
 installation.

Since my installation is not VTK 4.0, my interpretation of the help
string is that the value of this option should be PREFIX/lib/vtk or
actually PREFIX/lib/vtk-5.1 as this is the location of the file
VTKConfig.cmake. However this does not work, giving the message that
UseVTK.cmake can not be found in this location. So I think the message
means to say for any VTK version newer than or equal to 4.0 that the
location of UseVTK.cmake should be used for this option? Anyways that
does not work either for me, see error below.

Thanks
Robert




VTK is from cvs yesterday
CMAKE: current release 2.4.4 today (built from source)

Linux Redhat ws4 / amd64 system



The follwing are the screens of ccmake with the selected options:

This works:

CMAKE_BACKWARDS_COMPATIBILITY    2.4
CMAKE_BUILD_TYPE                 Release
CMAKE_INSTALL_PREFIX             /usr/local
EXECUTABLE_OUTPUT_PATH
LIBRARY_OUTPUT_PATH
VTK_DIR                          /sources/local/VTK_build


This does not work:

 CMAKE_BACKWARDS_COMPATIBILITY    2.4
 CMAKE_BUILD_TYPE                 Release
 CMAKE_INSTALL_PREFIX             /usr/local
 EXECUTABLE_OUTPUT_PATH
 LIBRARY_OUTPUT_PATH
 VTK_DIR                          /usr/local/include/vtk-5.1

I get the error:

 CMake Error: Error in cmake code at
 /usr/local/share/cmake-2.4/Modules/UseVTKConfig40.cmake:21:
 LOAD_CACHE Cannot load cache file from
 /usr/local/include/vtk-5.1/CMakeCache.txt
 Current CMake stack:
 
/home/rcatwood/progs/vtk_progs/CMakeLists.txt;/usr/local/share/cmake-2.4
/Mod
 
ules/CMakeCInformation.cmake;/usr/local/share/cmake-2.4/Modules/CMakeCXX
Info
 
rmation.cmake;/usr/local/share/cmake-2.4/Modules/FindVTK.cmake;/usr/loca
l/sh
 are/cmake-2.4/Modules/UseVTKConfig40.cmake


_____________________ CMakeLists.txt:

PROJECT (Step1)

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

ADD_EXECUTABLE(Cone Cone.cxx)
TARGET_LINK_LIBRARIES(Cone vtkRendering)



More information about the vtkusers mailing list