Skip to content

ENH: GDCM skip find_package when *_LIBRARIES pre-set#6502

Open
blowekamp wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
blowekamp:gdcm_support_system_deps
Open

ENH: GDCM skip find_package when *_LIBRARIES pre-set#6502
blowekamp wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
blowekamp:gdcm_support_system_deps

Conversation

@blowekamp

Copy link
Copy Markdown
Member

Use ITK module interface targets for GDCM system libraries.

Replace the EXPAT_INCLUDE_DIR/EXPAT_LIBRARY (singular) hint variables
with EXPAT_LIBRARIES/ZLIB_LIBRARIES pre-set to ITK::ITKExpatModule
and ITK::ITKZLIBModule. Guard each find_package call in the GDCM
source with if(NOT <pkg>_LIBRARIES) so a parent project that pre-sets
the plural _LIBRARIES variable skips the find entirely — the same
pattern used in the ITK DCMTK third-party module.

AI assistance
  • Tool: GitHub Copilot (Claude Sonnet 4.6)
  • Role: identified the skip-find pattern from InsightSoftwareConsortium/DCMTK@7c7dc11, applied it to GDCM ZLIB/Expat/OpenJPEG blocks, and drafted the commit

@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation area:ThirdParty Issues affecting the ThirdParty module labels Jun 24, 2026
@blowekamp

Copy link
Copy Markdown
Member Author

Updating GDCM before rebasing these changes: #6520

Guard GDCM system-library find_package with if(NOT <pkg>_LIBRARIES) so
ITK module interface targets directly can be set directly.

Set EXPAT_LIBRARIES/ZLIB_LIBRARIES/OPENJPEG_LIBRARIES to
ITK::ITKExpatModule, ITK::ITKZLIBModule, ITK::ITKOpenJPEGModule,
and GDCM_JPEGTURBO_LIBRARIES to ITK::ITKJPEGModule, bypassing
GDCM's internal bundled copies.
@blowekamp blowekamp force-pushed the gdcm_support_system_deps branch from cf3de9e to ffb7258 Compare June 27, 2026 11:39
@blowekamp blowekamp marked this pull request as ready for review June 27, 2026 13:36
@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the GDCM third-party CMake setup to rely on ITK module targets.

  • Expat and ZLIB library variables now point at ITK interface targets.
  • OpenJPEG discovery is skipped when libraries are already supplied.
  • JPEG Turbo linking now uses the ITK JPEG module target.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The changed dependency paths still link the relevant ITK interface targets.
  • The reviewed include paths are provided through those targets for the ITK build path.

Important Files Changed

Filename Overview
Modules/ThirdParty/GDCM/src/CMakeLists.txt Switches GDCM dependency hints from explicit include/library variables to ITK module interface targets.
Modules/ThirdParty/GDCM/src/gdcm/CMakeLists.txt Adds guarded OpenJPEG package discovery when no OpenJPEG libraries are pre-set.

Reviews (1): Last reviewed commit: "ENH: GDCM skip find_package when *_LIBRA..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ThirdParty Issues affecting the ThirdParty module type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant