Skip to content

fix: export hdf5sz3 target and resolve dependencies for find_package consumers - #126

Merged
ayzk merged 1 commit into
masterfrom
fix/hdf5sz3-cmake-export
Feb 19, 2026
Merged

ayzk merged 1 commit into
masterfrom
fix/hdf5sz3-cmake-export

Conversation

@ayzk

@ayzk ayzk commented Feb 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR updates SZ3Config.cmake.in to properly export the hdf5sz3 target and resolve its dependencies for downstream projects using find_package(SZ3).

Changes

  • SZ3Config.cmake.in: Conditionally include HDF5SZ3.cmake export with find_package(HDF5) and conditional find_package(MPI) for parallel HDF5

Problem

After PR #125, the hdf5sz3 target is exported to the install tree, but SZ3Config.cmake did not include the export file or resolve its transitive dependencies (HDF5::HDF5, MPI::MPI_CXX). This caused configuration errors for downstream projects.

Verified

Both import methods tested with #include <H5Z_SZ3.hpp>:

  • find_package(SZ3) + SZ3::hdf5sz3: PASS
  • FetchContent + hdf5sz3: PASS

- Add install(EXPORT HDF5SZ3) to install the hdf5sz3 CMake target
- Update SZ3Config.cmake.in to include HDF5SZ3 export with HDF5 and
  conditional MPI dependency resolution
- Enables #include <H5Z_SZ3.hpp> to work when using find_package(SZ3)
  and linking SZ3::hdf5sz3
Copilot AI review requested due to automatic review settings February 19, 2026 01:33
@ayzk
ayzk merged commit 4359047 into master Feb 19, 2026
17 checks passed
@ayzk
ayzk deleted the fix/hdf5sz3-cmake-export branch February 19, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to fix dependency resolution for the hdf5sz3 target in downstream projects using find_package(SZ3). It adds conditional MPI dependency resolution based on whether HDF5 was built with parallel support, complementing the existing HDF5 dependency resolution added to handle the hdf5sz3 target export from PR #125.

Changes:

  • Added conditional MPI dependency resolution in SZ3Config.cmake.in, checking if HDF5 is parallel before requiring MPI with CXX component

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread SZ3Config.cmake.in
include("${CMAKE_CURRENT_LIST_DIR}/SZ3Targets.cmake")
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/HDF5SZ3.cmake")
find_package(HDF5 COMPONENTS C REQUIRED)
if(@HDF5_IS_PARALLEL@)

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

The variable HDF5_IS_PARALLEL is not available in the parent scope when configure_package_config_file is called in CMakeLists.txt:122. The find_package(HDF5) call that sets HDF5_IS_PARALLEL only occurs in tools/H5Z-SZ3/CMakeLists.txt:7, which is a subdirectory scope that doesn't propagate variables to the parent. This means @HDF5_IS_PARALLEL@ will be empty or undefined in the generated SZ3Config.cmake file, causing the conditional check to fail or behave incorrectly. To fix this, you need to either: (1) call find_package(HDF5) in the parent CMakeLists.txt before configure_package_config_file when BUILD_H5Z_FILTER is ON, or (2) explicitly propagate HDF5_IS_PARALLEL to parent scope in tools/H5Z-SZ3/CMakeLists.txt using set(HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} PARENT_SCOPE).

Suggested change
if(@HDF5_IS_PARALLEL@)
if(HDF5_IS_PARALLEL)

Copilot uses AI. Check for mistakes.
ayzk added a commit that referenced this pull request Apr 26, 2026
Brings in upstream changes that don't touch docs/:

  * HDF5 target export improvements (#125, #126, #128)
    - SZ3::hdf5sz3 target now exposed in build + export trees
    - Cleanups in tools/H5Z-SZ3, mdz, sz3c CMakeLists
  * NixOS support: new default.nix (#129)
  * Lorenzo predictor pointer-arith UB fix (#121)
    - LorenzoPredictor.hpp + QuantOptimization.hpp:
      d[-i] -> *(d - i) to avoid size_t unsigned wrap-around

.gitignore: union merge (master adds sz3_install / sz3_build / test;
fz keeps tmp / .cache / docs/site/html / .claude).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants