[CMake] Puzzle about CMAKE_MODULE_PATH

Mark Foskey mark_foskey at unc.edu
Wed Sep 14 10:02:35 EDT 2005


I'm trying to build SNAP, which is a part of the InsightApplications 
suite, outside of InsightApplications.  I'm working under Linux.

To make it easier for ITK and VTK to be found, I set the following 
environment varibles:

   ITK_DIR=/afs/radonc/libraries/itk/build
   VTK_DIR=/afs/radonc/libraries/vtk/build

I also set a variable so that the SNAP CMakeLists.txt file calls 
FIND_PACKAGE(ITK) and FIND_PACKAGE(VTK).  Unfortunately, the environment 
variables are ignored by the package-finding modules -- I get:

   Cannot build InsightApplications without ITK.  Please set ITK_DIR.

However, if I put

    SET( CMAKE_MODULE_PATH "/afs/radonc/pkg/cmake/share/CMake/Modules/" )

in the SNAP CMakeLists.txt file, both ITK and VTK are found just fine.

This is mysterious to me.  I think ccmake is finding the Modules 
directory even without the CMAKE_MODULE_PATH, since it otherwise runs 
OK, and since the modules directory is findable (via a softlink) as 
${CMAKE_ROOT}/Modules.  So why does it behave differently, apparently 
not using Modules/FindITK.cmake, when CMAKE_MODULE_PATH is not set?

Thanks for any information,
Mark

-- 
Mark Foskey  (919) 966-1101 x245  Radiation Oncology, CB 7512
mark_foskey[at]unc.edu            University of North Carolina
http://www.cs.unc.edu/~foskey     Chapel Hill, NC  27599-7512


More information about the CMake mailing list