WIP: ENH: Adjust RTK applications and example to modern CMake interface#894
WIP: ENH: Adjust RTK applications and example to modern CMake interface#894SimonRit wants to merge 1 commit intoRTKConsortium:mainfrom
Conversation
|
This currently does not work, it does not register ITK factories for an unknown reason. When executing If I rollback to using |
|
In the latest force push, I added this code copy pasted from UseITK.cmake. Then, RTK's applications work. However, the examples (external applications using RTK) still fail due to missing factories so something's not right and I don't know what. |
blowekamp
left a comment
There was a problem hiding this comment.
Thank you for trying out the latest changed in ITK right away.
You may want to create a linking function or some variables to avoid the duplicated conditionings.
I was uncertain what to run to reproduce your error messages.
| if("${ITK_VERSION_MAJOR}" VERSION_LESS "6") | ||
| target_link_libraries(ConjugateGradient ${ITK_LIBRARIES}) | ||
| else() | ||
| target_link_libraries(ConjugateGradient ITK::RTKModule) |
There was a problem hiding this comment.
You were previously linking to all loaded ITK modules, and presumably using them with "UseITK".
Using ITK_INTERFACE_LIBRARIES will apply properties and line to all the ITK::{module-name}Module loaded in the find_package. This may include additional modules no specified as dependents of just the RTK Module.
applications/CMakeLists.txt
Outdated
| PROPERTY | ||
| COMPILE_DEFINITIONS | ||
| ITK_${_factory_uc}_FACTORY_REGISTER_MANAGER | ||
| ) |
There was a problem hiding this comment.
The migration guide contains some information on "Factory Registration with Meta Modules": https://docs.itk.org/en/latest/migration_guides/itk_6_migration_guide.html#application-configuration
The docs are missing that an application should also link to the meta-module "ITK::ITKImageIO". These meta-module have the properties of the include and compile definitions in them so they don't need to be set in at a directory/global level.
There was a problem hiding this comment.
Thanks, I have just force-pushed a new version which works. I am not entirely convinced though. Can I make the target RTKModule dependent on ITK::ITKImageIO and ITK::ITKFFTImageFilterInit to avoid having to specify it in each application and example?
By the way, the doc mentions ITKIOFFT which does not exist, I have used ITKFFTImageFilterInit instead.
Thanks again for you support!
See
https://docs.itk.org/en/latest/migration_guides/itk_6_migration_guide.html#migration-for-itk-modules for a detailed explanation.