ITK
ITK copied to clipboard
UseITK uses include_directories and link_directories
Description
UseITK.cmake
uses include_directories
and link_directories
.
Steps to Reproduce
N/A
Expected behavior
Variables should be returned such that target_include_directories
and target_link_libraries
can be used.
Actual behavior
https://github.com/InsightSoftwareConsortium/ITK/blob/c95b99852a9109a8fc176a06f88b2aa6d442154b/CMake/UseITK.cmake#L26-L30
https://github.com/InsightSoftwareConsortium/ITK/blob/c95b99852a9109a8fc176a06f88b2aa6d442154b/CMake/UseITK.cmake#L232
include_directores
pollutes the include path. Our code (https://github.com/CCPPETMR/SIRF) builds against both ITK and NiftyReg, both of which have a copy of nifti1.h
. For a particular library, we want to be using the NiftyReg files, but because of this issue, ITK includes get prepended. We therefore get into problems with the itk_nifti_mangle.h
.
You can see this problem, which is present in one of our Travis builds: https://travis-ci.org/CCPPETMR/SIRF/builds/618272131?utm_source=github_status&utm_medium=notification. There is one matrix in red, due to this problem.
Reproducibility
N/A
Versions
From at least 4.13
. Still present in master
.
Environment
Linux Ubuntu 14.04 (and potentially other distributions).
Additional Information
N/A
Any movement on this one?
Not really. ITK's build system pre-dates CMake 3 and its enablement of modern practices. Updating it is a huge undertaking, with lousy cost/benefit ratio. It will probably have to wait for the next big maintenance grant.
Expected behavior
Variables should be returned such that target_include_directories and target_link_libraries can be used.
This can currently be done by inspecting the ITK modules variables. Here is what I did in SimpleITK:
https://github.com/SimpleITK/SimpleITK/blob/master/CMake/sitkTargetUseITK.cmake
Perhaps it should be made more widely available.
This can currently be done by inspecting the ITK modules variables. Here is what I did in SimpleITK:
Do you use this for IO? I gave it a go lifting some relevant functionality from the UseITK.cmake
file, but got into trouble - I think because the ITKFactoryRegistration was empty.
Yes, it for every thing. From this commit in SimpleITK, the factory registration can be explicitly done when using the "ITKImageIO" and "ITKTransfromIO" modules.
@KrisThielemans info RE including ITK. SimpleITK's method looks good but potentially a lot of work to switch over.
thanks @rijobro. I have only very briefly glanced at this, and have no good idea what it would involve for us. Possibly that discussion should be held at https://github.com/UCL/STIR/issues/432 to avoid cluttering this, unless it's of general benefit of course?
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.