CMake

Il faut impérativement utiliser find_package avec des arguments.

find_package(HDF5 NAMES hdf5 COMPONENTS CXX static)
target_link_libraries(${PROJECT_NAME} PUBLIC hdf5::hdf5-static hdf5::hdf5_cpp-static)