FindHDF5 does not find HL component due to use of only the h5cc wrapper
When I use HDF5_NO_FIND_PACKAGE_CONFIG_FILE
to avoid use of hdf5-config.cmake
(or whatever .cmake
files HDF5 installs) on an HDF5 installed using CMake, FindHDF5
appears to only use h5cc
for introspection. h5cc
does not appear to contain any information about HL where, h5hlcc -showconfig
shows both the C and HL component libraries. If I then specify find_package(HDF5 REQUIRED COMPONENTS C HL)
in my project, the HL component will currently never be found. I am doing this on a Mac and haven't tried it on Linux yet. It appears there might also be different behavior of the compiler wrappers (and different compiler wrappers in general) between HDF5 installed with autotools and HDF5 installed with CMake. I will try to provide more information as I investigate, but I wanted to start this issue to help try to get it resolved in a future CMake. Assuming I'm not totally off base here.
For more information, this is basically exactly what I'm experiencing in my project https://github.com/spack/spack/pull/24922 . Where the hdf5-shared
library name gets propagated to an application downstream that doesn't directly rely on HDF5 and it tries to link to -lhdf5-shared
which doesn't exist. However, my project is slightly different in that I require the HL component which is why I need an extra step to solve it. Somewhat recently Spack switched to building HDF5 with CMake which is why I'm in this situation: https://github.com/spack/spack/pull/18937 . My current workaround is to remove h5cc
and symlink h5cc -> h5hlcc
. Doing this, my project is able to find the HL component and avoid using the wrong library names downstream.