HDF5 CMake build

CMake is required to build HDF5 2.0 and newer, building static and dynamic HDF5 libraries under the user install prefix. The *stub files may not be present, depending on the build configuration. We omit the file suffixes for simplicity.

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

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

include/

One straightforward build/install example is:

cmake -B build --install-prefix=$HOME/hdf5
cmake --build build --parallel
cmake --install build

Tell CMake to use this HDF5 from a user project:

cmake -B build -DHDF5_ROOT=$HOME/hdf5