Notes |
|
(0023484)
|
Brad King
|
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
|
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
|
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
|
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
|
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
|
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 |
|