Skip to content

Conversation

@blowekamp
Copy link
Member

Use "ZLIB:ZLIB" for system zlib libraries from standard CMake find package. For ITK usage of zlib change to use ITK::ITKZLIBModule which include a reference to the selected zlib library.

When the internal ITK library is selected the following export code occurs:

set_target_properties(ITK::ITKZLIBModule PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/scratch/itk/build-release/Modules/ThirdParty/ZLIB/src"
  INTERFACE_LINK_LIBRARIES "ITK::zlib"
)

While when a system zlib is selected:

set_target_properties(ITK::ITKZLIBModule PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/scratch/itk/build-system/Modules/ThirdParty/ZLIB/src"
  INTERFACE_LINK_LIBRARIES "ZLIB::ZLIB"
)

NOTE: Thirdparty ITK modules are still uses the directory property for include directories. I have local changes which can disable this per modules that have not been committed yet.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@github-actions github-actions bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Examples Demonstration of the use of classes area:ThirdParty Issues affecting the ThirdParty module type:Data Changes to testing data labels Feb 11, 2026
Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

Update last remaining examples to use ITK target modules.
@blowekamp blowekamp force-pushed the cmake_zlib_interface branch from 359958e to a560316 Compare February 12, 2026 16:14
@blowekamp
Copy link
Member Author

/azp ITK.Windows

@blowekamp blowekamp force-pushed the cmake_zlib_interface branch from a560316 to 6509014 Compare February 12, 2026 18:59
@thewtex thewtex added this to the ITK 6.0 Beta 2 milestone Feb 12, 2026
Use ITK::ITKZLIBModule interface target for usage of zlib in ITK
thirdparty libraries. This interface implicitly adds the required zlib
include directories.

Additionally, use the ZLIB:ZLIB imported interface for external zlib.
@blowekamp blowekamp force-pushed the cmake_zlib_interface branch from 6509014 to 8af1b5c Compare February 12, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Examples Demonstration of the use of classes area:ThirdParty Issues affecting the ThirdParty module type:Data Changes to testing data type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants