cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(hdf)
find_package(HDF5 REQUIRED COMPONENTS C CXX)
add_executable(hdf hdf.cpp)
target_link_libraries(hdf ${HDF5_HL_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES})
set_property(TARGET hdf PROPERTY CXX_STANDARD 17)
message(STATUS "INCLUDE LOCATION" ${HDF5_INCLUDE_DIRS})
message(STATUS "version" ${HDF5_VERSION})
message(STATUS "DEFINITIONS" ${HDF5_DEFINITIONS})
message(STATUS "LIBRARIES" ${HDF5_LIBRARIES})
message(STATUS "HL_LIBRARIES" ${HDF5_HL_LIBRARIES})
运行cmake,输出将产生
HDF5: Using hdf5 compiler wrapper to determine C configuration
显然所有的文件都找到了。
#include "H5Cpp.h"
我明白了
fatal error: H5Cpp.h: No such file or directory
#include "H5Cpp.h"
为什么呢?谢谢你的帮助