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:
- Edit the ./<HDF source>/config/cmake/UserMacros/Windows_MT.cmake file:
Set the correct options as needed (/MTd, /MT,..)
Turn BUILD_STATIC_CRT_LIBS on:
--- Last Modified: August 14, 2018 | 03:03 PM
option (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" ON)
INCLUDE(path_to_file/WINDOWS_MT.cmake)
Then you are ready to build HDF.