HDF5 CMake build
CMake is recommended to build HDF5 in general. CMake is required to build HDF5 on Windows. Trying to use Autotools to build HDF5 may encounter needless trouble compared to CMake.
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