[Insight-developers] Specifying the ITK_DIR path

Brad King brad.king at kitware.com
Thu Apr 5 10:08:25 EDT 2012


On 4/5/2012 9:14 AM, Bradley Lowekamp wrote:
 > When configuring a project to use ITK, it seems that I need to
 > add "lib/cmake" to the end of the install path to correctly

Don't you mean "lib/cmake/ITK-4.x"?

 > detect the installed ITK. This seems a bit awkward to me, and I
 > keep forgetting to do it. I am quite surprised that the cmake
 > find_package function doesn't do this. Is this the expected and
 > desired behavior?

Yes, and find_package has always worked that way.  There can be more
than one copy/version of a given package under the same prefix.  The
ITK_DIR value must point to the exact location of ITKConfig.cmake,
not just the install prefix.  Otherwise it would be ITK_ROOT or
ITK_PREFIX or something.

If you know you have only one ITK under a given prefix then just put
the prefix in CMAKE_PREFIX_PATH instead.  Then find_package will dig
into that to find lib/cmake/ITK-4.x automatically.

-Brad K


More information about the Insight-developers mailing list