gpt4 book ai didi

c++ - Visual Studio - Cmake 项目 - 添加 NetCDF

转载 作者:行者123 更新时间:2023-11-30 04:55:33 33 4
gpt4 key购买 nike

我有一个项目,我可以在Linux下编译,但也希望在windows环境下编译,即visual studio。

我安装了 netcdf,但是当我使用 cmake 构建时,出现此错误:

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
1> -- Checking for one of the modules 'netcdf'
1> CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.11/Modules/FindPkgConfig.cmake:641 (message):
1> None of the required 'netcdf' found

知道如何让 Visual Studio 找到 netcdf 包吗?

最佳答案

为了帮助您开始,请查看变量 PKG_CONFIG_EXECUTABLE .这个变量会将该搜索路径添加到 CMake 运行的 find_program 的子调用中。您可以在调用 FindPkgConfig 之前在 CMakeLists.txt 文件中设置该变量。

对于一些更完整的错误检查,您应该尝试始终查看 CMake 变量的相应“FOUND”或“NOTFOUND”属性:

if(PKG_CONFIG_FOUND)
message(STATUS "PKG_CONFIG_FOUND!")
else()
message(WARNING "PKG_CONFIG_FOUND was false!")
endif()

关于c++ - Visual Studio - Cmake 项目 - 添加 NetCDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52977344/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com