ITK_INSTALL_RUNTIME_DIR and ITK_INSTALL_LIBRARY_DIR are joined to CMAKE_INSTALL_PREFIX in several places, so an absolute value silently yields a malformed path. CMake installs an absolute DESTINATION outside the prefix, so the two disagree.
Where the assumption is made
| Site |
Expression |
CMake/ITKModuleMacros.cmake:533 |
"\${ITK_INSTALL_PREFIX}/${ITK_INSTALL_RUNTIME_DIR}" |
CMake/ITKModuleMacros.cmake:542 |
"\${ITK_INSTALL_PREFIX}/${ITK_INSTALL_LIBRARY_DIR}" |
Modules/Core/TestKernel/src/CMakeLists.txt |
the installed itkTestDriver RPATH |
The first two feed <module>_RUNTIME_LIBRARY_DIRS in the exported configuration, so a consumer of an installed ITK inherits the wrong directories, not just the test driver.
Defaults are relative (bin, and ${CMAKE_INSTALL_LIBDIR} which defaults to lib), so the supported configurations are unaffected.
What support would require
Each site needs to branch on IS_ABSOLUTE and skip the prefix join, and the exported ITKConfig would need the same treatment so that relocation logic does not rewrite a deliberately absolute path. That is a repo-wide change to the module macros and the exported configuration, which is why it is filed separately rather than folded into a single install rule.
A narrower alternative is to state in the documentation that these variables must be relative and keep the configure-time guards.
Found by an automated review on PR #6894, which added the itkTestDriver install RPATH. That PR guards its own computation with IS_ABSOLUTE and fails at configure time rather than emitting a wrong RPATH; the other two sites are unguarded.
ITK_INSTALL_RUNTIME_DIRandITK_INSTALL_LIBRARY_DIRare joined toCMAKE_INSTALL_PREFIXin several places, so an absolute value silently yields a malformed path. CMake installs an absoluteDESTINATIONoutside the prefix, so the two disagree.Where the assumption is made
CMake/ITKModuleMacros.cmake:533"\${ITK_INSTALL_PREFIX}/${ITK_INSTALL_RUNTIME_DIR}"CMake/ITKModuleMacros.cmake:542"\${ITK_INSTALL_PREFIX}/${ITK_INSTALL_LIBRARY_DIR}"Modules/Core/TestKernel/src/CMakeLists.txtitkTestDriverRPATHThe first two feed
<module>_RUNTIME_LIBRARY_DIRSin the exported configuration, so a consumer of an installed ITK inherits the wrong directories, not just the test driver.Defaults are relative (
bin, and${CMAKE_INSTALL_LIBDIR}which defaults tolib), so the supported configurations are unaffected.What support would require
Each site needs to branch on
IS_ABSOLUTEand skip the prefix join, and the exportedITKConfigwould need the same treatment so that relocation logic does not rewrite a deliberately absolute path. That is a repo-wide change to the module macros and the exported configuration, which is why it is filed separately rather than folded into a single install rule.A narrower alternative is to state in the documentation that these variables must be relative and keep the configure-time guards.
Found by an automated review on PR #6894, which added the
itkTestDriverinstall RPATH. That PR guards its own computation withIS_ABSOLUTEand fails at configure time rather than emitting a wrong RPATH; the other two sites are unguarded.