在Windows 10上使用HDF5:找不到HDF5(缺少:HDF5_DIR)

时间:2019-05-12 13:16:59

标签: cmake hdf5

我能够在MacOS和Linux上的C ++项目中成功使用HDF5。

当前,我正在尝试使其在Windows 10上运行,但得到以下CMake输出:

-- Could NOT find HDF5 (missing: HDF5_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/z/hdf5parser/cmake-build-debug

我在Windows上安装了HDF5的预构建二进制发行版,并将环境变量HDF5_DIR设置为C:/Program Files/HDF_Group/HDF5/1.10.5/cmake

根据官方文档,我在项目中使用以下CMake配置:

cmake_minimum_required (VERSION 3.10)
project (HDF5MyApp C CXX)

set (LIB_TYPE STATIC) # or SHARED
string(TOLOWER ${LIB_TYPE} SEARCH_TYPE)

find_package (HDF5 NAMES hdf5 COMPONENTS C ${SEARCH_TYPE})
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIR}")
set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY})

set (example HdfHandler)

add_executable(...) # I skipped this part

target_link_libraries(hdf5parser PRIVATE ${LINK_LIBS})

有人遇到类似的问题吗?或者可以给我提示在Windows上使用HDF5?

0 个答案:

没有答案