HDF5 CMake build

We strongly recommend using CMake to build HDF5. CMake is required to build HDF5 on Windows.

HDF5 builds test executables that don’t pickup CMake environment variables. Set compiler variables CC and FC in the shell, particularly when using non-system-default compilers.

Avoid this issues by building HDF5 with CMake.

This creates static and dynamic HDF5 libraries under the user install prefix–we don’t show the library suffixes for simplicity. Note: the *stub files may not be present.

hdf5/lib/libhdf5
hdf5/lib/libhdf5_fortran
hdf5/lib/libhdf5_hl
hdf5/lib/libhdf5_hl_fortran
hdf5/lib/libhdf5_hl_f90cstub
hdf5/lib/libhdf5_f90cstub

The Fortran .mod files that need to be included are under

hdf5/include/

Tell CMake to use this HDF5 from the user project:

cmake -B build -DHDF5_ROOT=~/.local/hdf5