COMP: Fix COMPILE_DEPENDS → DEPENDS in three Filtering module declara…#6097
Conversation
…tions ITKImageIntensity, ITKDenoising, and ITKDiffusionTensorImage declared their dependencies with COMPILE_DEPENDS instead of DEPENDS. COMPILE_DEPENDS only populates the legacy include_directories() path and does not call target_link_libraries(), so no CMake target link is established and INTERFACE_INCLUDE_DIRECTORIES cannot propagate transitively. This breaks builds with system Eigen (ITK_USE_SYSTEM_EIGEN=ON): the Eigen3::Eigen include path is silently dropped, causing failures in headers such as itkSymmetricEigenAnalysis.h. Since these modules genuinely link against their listed dependencies, DEPENDS is semantically correct.
|
This issue was encountered when trying to build the conda-forge libitk-feedstock against the current ITK main. The build uses eigen provided by conda-forge. |
|
| Filename | Overview |
|---|---|
| Modules/Filtering/Denoising/itk-module.cmake | Changed COMPILE_DEPENDS → DEPENDS so ITKImageAdaptors, ITKImageGrid, ITKImageStatistics, ITKIOImageBase, and ITKStatistics are properly linked via target_link_libraries() and propagate INTERFACE_INCLUDE_DIRECTORIES transitively. |
| Modules/Filtering/DiffusionTensorImage/itk-module.cmake | Changed COMPILE_DEPENDS → DEPENDS for ITKSpatialObjects, establishing proper CMake target link and transitive include propagation for this module. |
| Modules/Filtering/ImageIntensity/itk-module.cmake | Changed COMPILE_DEPENDS → DEPENDS for ITKImageAdaptors, ITKImageStatistics, ITKImageGrid, and ITKPath — the fix that directly restores the Eigen3::Eigen include path when ITK_USE_SYSTEM_EIGEN=ON. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["itk_module() with COMPILE_DEPENDS\n(before fix)"] -->|"add_dependencies() only"| B["Module is built after dependency\n(ordering guarantee only)"]
B --> C["target_link_libraries() NOT called"]
C --> D["INTERFACE_INCLUDE_DIRECTORIES\nnot propagated transitively"]
D --> E["❌ Eigen3::Eigen include path missing\n→ build failure with ITK_USE_SYSTEM_EIGEN=ON"]
F["itk_module() with DEPENDS\n(after fix)"] -->|"add_dependencies() + target_link_libraries()"| G["Module is built after dependency\n(ordering guarantee)"]
G --> H["INTERFACE_INCLUDE_DIRECTORIES\npropagated transitively"]
H --> I["✅ Eigen3::Eigen include path available\n→ itkSymmetricEigenAnalysis.h compiles correctly"]
Reviews (1): Last reviewed commit: "COMP: Fix COMPILE_DEPENDS → DEPENDS in t..." | Re-trigger Greptile
…tions
ITKImageIntensity, ITKDenoising, and ITKDiffusionTensorImage declared their dependencies with COMPILE_DEPENDS instead of DEPENDS. COMPILE_DEPENDS only populates the legacy include_directories() path and does not call target_link_libraries(), so no CMake target link is established and INTERFACE_INCLUDE_DIRECTORIES cannot propagate transitively.
This breaks builds with system Eigen (ITK_USE_SYSTEM_EIGEN=ON): the Eigen3::Eigen include path is silently dropped, causing failures in headers such as itkSymmetricEigenAnalysis.h. Since these modules genuinely link against their listed dependencies, DEPENDS is semantically correct.
PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.