FindHDF5 depends on using the h5cc wrapper compiler. This wrapper does not get built when HDF5 is built with CMake
It looks like the FindHDF5
module depends on the HDF5 wrapper compilers (h5cc
and related).
Judging from this https://forum.hdfgroup.org/t/compile-hdf5-compilers/3644 the wrappers are not created when HDF5 is built with CMake.
If, for some reason, a wrapper compiler is in the path (there are cases where this is unavoidable) but you want to select another HDF5 installation and use HDF5_ROOT
to point FindHDF5.cmake
there, the found HDF5_LIBRARIES
can include unwanted libraries that originate from the wrapper compiler.
Personally, I find the fact that the wrapper compiler is not built when HDF5 is built with CMake and that it is subsequently used by CMake's FindHDF5.cmake module a bit strange. It looks like the FindHDF5.cmake module should not use h5cc. Please help me understand this situation if I am mistaken