[CMake] CMake 2.8.4 -- FindITK.cmake fails to find ITK even when ITK_DIR is properly set.

kent williams nkwmailinglists at gmail.com
Mon Mar 7 15:59:39 EST 2011


My first subject line was "Who decided to break FindITK.cmake in
2.8.4?" but that isn't probably very tactful.

We have a whole bunch of projects that used to configure and build
just fine with CMake 2.8.3. With 2.8.4 they fail.

The error message we get is:

CMake Error at /opt/cmake-2.8.4-Darwin-universal/CMake
2.8-4.app/Contents/share/cmake-2.8/Modules/FindITK.cmake:52 (MESSAGE):
  Please set ITK_DIR to the directory containing ITKConfig.cmake.  This is
  either the root of the build tree, or PREFIX/lib/InsightToolkit for an
  installation.
Call Stack (most recent call first):
  BuildScripts/CMakeCommonExternalDefinitions.cmake:23 (find_package)
  CMakeLists.txt:70 (PACKAGE_NEEDS_ITK)

We DO set ITK_DIR at configure time, and I HAVE verified that
ITKConfig.cmake DOES exist in ${ITK_DIR}.

Looking at the difference between FindITK.cmake in 2.8.3 and 2.8.4 it
looks like someone replaced trusting the ITK_DIR variable and using it
directly if defined, with

FIND_PACKAGE(ITK QUIET NO_MODULE
NAMES ITK InsightToolkit CONFIGS ITKConfig.cmake)

Which doesn't work -- it appears to ignore ITK_DIR and doggedly insist
that it can't find ITK.

What gives?


More information about the CMake mailing list