COMP: Backport IO modules publicly depend on ImageIOBase#6068
COMP: Backport IO modules publicly depend on ImageIOBase#6068hjmjohnson wants to merge 2 commits intoInsightSoftwareConsortium:release-5.4from
Conversation
Change ITKIOImageBase from PRIVATE_DEPENDS to DEPENDS for the ITKIOVTK module. External projects linking against ITKIOVTK need the ImageIOBase headers and link targets transitively. Cherry-pick of 12be740 from main.
|
| Filename | Overview |
|---|---|
| Modules/IO/VTK/itk-module.cmake | Moves ITKIOImageBase from PRIVATE_DEPENDS to DEPENDS — correct because itkVTKImageIO.h publicly includes headers from ITKIOImageBase; consistent with all other comparable IO module declarations. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["External Project\n(find_package ITKIOVTK)"] -->|"DEPENDS (public)"| B["ITKIOVTK"]
B -->|"DEPENDS (public)"| C["ITKIOImageBase"]
C -->|"DEPENDS (public)"| D["ITKCommon"]
B -.->|"Before: PRIVATE_DEPENDS\n(not propagated)"| C
style B fill:#4a90d9,color:#fff
style C fill:#27ae60,color:#fff
Reviews (1): Last reviewed commit: "COMP: VTKImageIO publicly depends on Ima..." | Re-trigger Greptile
|
Why was this one change in DEPENDS selected? That were probably a dozen similar changes to other modules that occurred during the implementation of CMake Interfaces. I am suspicious this was just selected by AI due to minimal context windows and no real logic on why it needs to be backported compared to the other similar changes. |
CSV, DCMTK, GE, LSM, and PhilipsREC still had ITKIOImageBase under PRIVATE_DEPENDS. This is incorrect because their public headers include ITKIOImageBase headers, so downstream projects need the transitive dependency. The same issue exists on main and has not yet been fixed there either.
|
@blowekamp Fair question — here's the context: The original cherry-pick was faithful to your commit On closer investigation, 5 additional IO modules on I've expanded this PR to fix all 6 modules and converted it to draft — the broader scope may be out of bounds for a patch release backport. Happy to:
What's your preference? |
I don't know who or what am taking to... What was the reason of this patch to be included? Was there an issue in release-5.4 or was this original PR just marked as a BUG fix and it was included? |
|
@blowekamp This is Hans. I used Claude Code as a tool to help identify and prepare backport candidates from the To your second question: there was no specific bug report. The original inclusion logic was:
Your concern was valid — if VTK needed fixing, the other modules with the same issue should be addressed too. I've expanded the PR to fix all 6 affected modules (CSV, DCMTK, GE, LSM, the Philips module, and VTK). The same 5 non-VTK modules are also still That said, since there's no reported downstream breakage from this on release-5.4, this is a correctness fix rather than a bug fix. If you think it doesn't belong in a patch release, I'm happy to close this and instead open a PR on |
|
Closing, as it feels like this is out of scope for a backport and should not have been considered. I'll update the related Issue #6051 to reflect the rejection of the backport. |
Move
ITKIOImageBasefromPRIVATE_DEPENDStoDEPENDSfor all 6 IO modules that incorrectly kept it private onrelease-5.4: VTK, CSV, DCMTK, GE, LSM, and the Philips REC module.IO modules whose public headers include ITKIOImageBase headers need
DEPENDS(public/transitive) so downstream consumers receive the include paths and link targets automatically. WithPRIVATE_DEPENDS, external projects that link against these IO modules may fail to find ITKIOImageBase headers.Scope and verification
Origin: Brad's PR #5850 on
mainfixed VTK only. This PR extends the same fix to the 5 remaining modules that have the identical issue on bothrelease-5.4andmain.Modules changed:
PRIVATE_DEPENDStoDEPENDS(cherry-pick of12be7405)PRIVATE_DEPENDStoDEPENDSPRIVATE_DEPENDSto newDEPENDSsectionPRIVATE_DEPENDSinto existingDEPENDSPRIVATE_DEPENDSinto existingDEPENDSPRIVATE_DEPENDStoDEPENDSLocal build verification (macOS, CMake 3.26.6, Ninja, Release):
ITKIOImageBaseappears inPUBLIC_DEPENDSandTRANSITIVE_DEPENDSCMake version compatibility: The
itk_module()macro mapsDEPENDS/PRIVATE_DEPENDStotarget_link_libraries(... LINK_PUBLIC/LINK_PRIVATE ...), available since CMake 2.8.12. ITK release-5.4 minimum is 3.16.3. No version concern.