Users may wish to link to the static runtime library on Windows to avoid linker errors and incompatibilities with other libraries. Linking to the static runtime library means the runtime is linked into the final exe.
You have to build from source with CMake to do this. See: Building HDF5 with CMake or Building HDF4 with CMake.
Make the following changes to the source code before building:
Set the correct options as needed (/MTd, /MT,..)
Turn BUILD_STATIC_CRT_LIBS on:
option (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" ON)