[vtk-developers] find_package( VTK ) and relative path

Arnaud Gelas arnaud_gelas at hms.harvard.edu
Mon Sep 19 09:22:02 EDT 2011


Hi all,

In one CMakeLists.txt, I have

find_package( VTK REQUIRED )
if( VTK_FOUND )
	include( ${VTK_USE_FILE} )
endif()

if I provide VTK_DIR by using a relative path, it does not work (see  
error message below); if I enter the full path it works.

This is the error message:

CMake Error at /opt/local/share/cmake-2.8/Modules/FindVTK.cmake:135
  (MESSAGE):
    VTK not found.  Set the VTK_DIR cmake cache entry to 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.
  Call Stack (most recent call first):
    Exercises/LevelSets/Source/CMakeLists.txt:13 (find_package)


This could have been fine and understandable if it was the same  
behavior for ITK, but it's not...

i.e.

find_package( ITK REQUIRED )
if( ITK_FOUND )
	include( ${ITK_USE_FILE} )
endif()

if a relative path is provided, it does work.

I use CMake 2.8.5, I build the master branch of VTK myself with the  
same version of CMake...

Can someone explain to me what's the difference in between ITK and VTK  
with respect to find_package? why is it working for one and not the  
other one?
If relative paths are not supported, why doesn't it warn users?

Thanks,
Arnaud



More information about the vtk-developers mailing list