CMake links HDF5 into your C, C++, or Fortran program with just a few lines in your CMake file.
I have an example CMake for writing network data to HDF5 in C.
We can create an even simpler example below used with a simple HDF5 read/write example:
cmake_minimum_required (VERSION 3.1) #yes, CMake 3.1 is required
HDF5 C example