Skip to content

FindHDF5: fix compiler detection when HL is disabled

Seth R Johnson requested to merge sethrj/cmake:findhdf5-fix-nohl into master

A valid HDF5 installation with the "high level" extensions not configured will fail to be correctly detected by CMake (see !4345 (merged)):

/rnsdhpc/code/findhdf5-test/build/CMakeFiles/hdf5/cmake_hdf5_test.c:2:10: fatal error: 'hdf5_hl.h' file not found
         ^~~~~~~~~~~
1 error generated.
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.

This does not stop the configuration but does prevent flags and libraries from being recognized by the script, causing build errors as documented in https://github.com/spack/spack/issues/17846 .

See https://gitlab.kitware.com/sethrj/findhdf5-test/-/commits/missing-hl documenting the before/after error messages.

This one-line fix should be considered for inclusion in a 3.18 bugfix release. Thanks!

Backport: release

Edited by Brad King

Merge request reports