View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011494CMakeModulespublic2010-11-22 12:162011-01-12 07:50
Reportermrceresa 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.3 
Target VersionCMake 2.8.4Fixed in VersionCMake 2.8.4 
Summary0011494: FindITK.cmake path list is incomplete
DescriptionHello,
I'm packaging the InsightToolkit for Fedora. I noticed that the only paths defined in FindITK.cmake are:

/usr/local/lib/InsightToolkit
/usr/lib/InsightToolkit

However the correct path for a Fedora distribution probably is:

/usr/share/InsightToolkit

As with the current configuration, find_package(ITK) fails, would it be possible to add this path to the FindITK.cmake that is shipped with CMake?

I have to admit that I don't understand completely how cmake finds software when there is no Find<package>.cmake so, maybe, this can be fixed without modifying this file!

Thanks for any help you can provide on this issue and best regards,

Mario
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0023484)
Brad King (manager)
2010-11-22 13:01

Upstream ITK installs ITKConfig.cmake to <prefix>/lib because it can contain arch-specific information so it does not belong in <prefix>/share.
(0023485)
Ben Boeckel (developer)
2010-11-22 13:03

Hi, a fellow Fedora packager here.

Since ITKConfig.cmake most likely contains arch-specific information (e.g., full paths to libraries), they cannot go into /usr/share. What may need to be done is to have it search /usr/lib${LIB_SUFFIX}/InsightToolkit (similar /usr/local too) so that on 64bit, it can be found in /usr/lib64.

I'd keep the ITKConfig in the path where it wants to install it.
(0023487)
Brad King (manager)
2010-11-22 13:25

> search /usr/lib${LIB_SUFFIX}

The find_package command's "config" mode (enabled by NO_MODULE option or lack of a Find<pkg>.cmake module) already knows how to look in lib64 when appropriate. What we really need to do is refactor FindITK.cmake to start with something like

  find_package(ITK QUIET NO_MODULE)

and then fall back to its old approach otherwise. I already did this refactoring for FindVTK:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c1a01dc [^]
(0023488)
mrceresa (reporter)
2010-11-22 14:05

Hey, thanks for the replies!

Sorry I wasn't aware that ITKConfig.cmake doesn't belong to /usr/share.

I liked the idea of using the config modality to search for itk and then fall back to the module way, but probably I got the implementation wrong :)

I put FIND_PACKAGE(ITK QUIET NO_MODULE) at the very beginning of the FindITK.cmake and I moved ITKConfig.cmake back to /usr/lib64/InsightToolkit, but it still doesn't work.

The only (relevant) cmake output for a very simple project that only searches ITK is attached below:

test_itk/CMakeLists.txt(1): FIND_PACKAGE(ITK )
/usr/share/cmake/Modules/FindITK.cmake(36): SET(ITK_DIR_STRING directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation. )
/usr/share/cmake/Modules/FindITK.cmake(38): FIND_PACKAGE(ITK QUIET NO_MODULE )
/usr/share/cmake/Modules/FindITK.cmake(41): IF(NOT ITK_DIR )
/usr/share/cmake/Modules/FindITK.cmake(43): IF(UNIX )
/usr/share/cmake/Modules/FindITK.cmake(44): STRING(REGEX MATCHALL [^:]+ ITK_DIR_SEARCH1 $ENV{PATH} )
/usr/share/cmake/Modules/FindITK.cmake(48): STRING(REGEX REPLACE /; ; ITK_DIR_SEARCH2 ${ITK_DIR_SEARCH1} )
/usr/share/cmake/Modules/FindITK.cmake(51): SET(ITK_DIR_SEARCH )
/usr/share/cmake/Modules/FindITK.cmake(52): FOREACH(dir ${ITK_DIR_SEARCH2} )
/usr/share/cmake/Modules/FindITK.cmake(53): SET(ITK_DIR_SEARCH ${ITK_DIR_SEARCH} ${dir}/../lib/InsightToolkit )
/usr/share/cmake/Modules/FindITK.cmake(59): FIND_PATH(ITK_DIR ITKConfig.cmake $ENV{ITK_DIR} ${ITK_DIR_SEARCH} /usr/local/lib/InsightToolkit /usr/lib/InsightToolkit [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] DOC The ${ITK_DIR_STRING} )
/usr/share/cmake/Modules/FindITK.cmake(90): IF(ITK_DIR )
/usr/share/cmake/Modules/FindITK.cmake(97): SET(ITK_FOUND 0 )
/usr/share/cmake/Modules/FindITK.cmake(98): IF(ITK_FIND_REQUIRED )
test_itk/CMakeLists.txt(2): IF(ITK_FOUND )
test_itk/CMakeLists.txt(5): MESSAGE(FATAL_ERROR ITK not found. Please set ITK_DIR. )
CMake Error at CMakeLists.txt:5 (MESSAGE):
  ITK not found. Please set ITK_DIR.
(0023491)
Brad King (manager)
2010-11-22 14:20

It's a bit different for FindITK than it was for FindVTK, for 2 reasons:

- FindITK needs to search in "InsightToolkit" paths instead of just "ITK"
- FindITK does not have the ancient VTK 4.0 compatibility mode that FindVTK needed

Actually the only reason FindVTK kept the "legacy" search code was for VTK 4.0. The "config" mode of find_package already searches *everywhere* that the old FindITK code did anyway. Therefore we can just remove the old code.

I've already committed/published the change in CMake:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38b0a84e [^]

A side effect is that it will actually look in <prefix>/share too as you originally requested. I still maintain that ITKConfig belongs in <prefix>/lib though.
(0023495)
mrceresa (reporter)
2010-11-22 14:37

Ah now I got it! Thanks a lot for your help.

I'll leave ITKConfig in <prefix>/lib${LIB_SUFFIX} in the package

 Issue History
Date Modified Username Field Change
2010-11-22 12:16 mrceresa New Issue
2010-11-22 13:01 Brad King Note Added: 0023484
2010-11-22 13:03 Ben Boeckel Note Added: 0023485
2010-11-22 13:25 Brad King Note Added: 0023487
2010-11-22 13:25 Brad King Assigned To => Brad King
2010-11-22 13:25 Brad King Status new => assigned
2010-11-22 14:05 mrceresa Note Added: 0023488
2010-11-22 14:20 Brad King Note Added: 0023491
2010-11-22 14:37 mrceresa Note Added: 0023495
2010-11-22 14:39 Brad King Status assigned => closed
2010-11-22 14:39 Brad King Resolution open => fixed
2011-01-12 07:50 David Cole Fixed in Version => CMake 2.8.4
2011-01-12 07:50 David Cole Target Version => CMake 2.8.4


Copyright © 2000 - 2018 MantisBT Team