boost - CMake 发现 Boost 但未设置 Boost_INCLUDE_DIR
问题描述
我正在尝试使用内置源代码版本的 Boost 在 CentOS 5 上构建 CMake 项目。我已经在/tmp/boost/boost_1_74_0
. 在我的CMakeLists.txt
尝试中,我尝试使用find_package(Boost 1.72 REQUIRED COMPONENTS graph)
. 我也-DBOOST_ROOT=/tmp/boost/boost_1_74_0
传给cmake
.
调用find_package
表面上是成功的。但是,Boost_INCLUDE_DIR
随后仍设置为Boost_INCLUDE_DIR-NOTFOUND
。我不明白为什么或如何发生这种情况,该项目建立在我通过包管理器安装了 Boost 的其他几个系统上。即使我符号链接或复制/tmp/boost/boost_1_74_0/boost
到/usr/include
,CMake 仍然无法设置Boost_INCLUDE_DIR
。这里可能是什么问题?
这是我还指定时 CMake 输出的内容-DBoost_DEBUG=ON
:
-- Finding boost...
-- Found Boost 1.74.0 at /usr/lib/cmake/Boost-1.74.0
-- Requested configuration: QUIET REQUIRED COMPONENTS graph
-- BoostConfig: find_package(boost_headers 1.74.0 EXACT CONFIG REQUIRED QUIET HINTS /usr/lib/cmake)
-- Found boost_headers 1.74.0 at /usr/lib/cmake/boost_headers-1.74.0
-- BoostConfig: find_package(boost_graph 1.74.0 EXACT CONFIG REQUIRED QUIET HINTS /usr/lib/cmake)
-- Found boost_graph 1.74.0 at /usr/lib/cmake/boost_graph-1.74.0
-- Boost toolset is gcc8 (GNU 8.3.1)
-- Scanning /usr/lib/cmake/boost_graph-1.74.0/libboost_graph-variant*.cmake
-- Including /usr/lib/cmake/boost_graph-1.74.0/libboost_graph-variant-shared.cmake
-- [x] libboost_graph.so.1.74.0
-- Including /usr/lib/cmake/boost_graph-1.74.0/libboost_graph-variant-static.cmake
-- [ ] libboost_graph.a
-- Adding boost_graph dependencies: regexheaders
-- Found boost_regex 1.74.0 at /usr/lib/cmake/boost_regex-1.74.0
-- Boost toolset is gcc8 (GNU 8.3.1)
-- Scanning /usr/lib/cmake/boost_regex-1.74.0/libboost_regex-variant*.cmake
-- Including /usr/lib/cmake/boost_regex-1.74.0/libboost_regex-variant-shared.cmake
-- [x] libboost_regex.so.1.74.0
-- Including /usr/lib/cmake/boost_regex-1.74.0/libboost_regex-variant-static.cmake
-- [ ] libboost_regex.a
-- Adding boost_regex dependencies: headers
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_INCLUDE_DIR
解决方案
Boost_INCLUDE_DIR
是一个变量,可以指定为 FindBoost.cmake 模块的输入以查找 Boost 安装。您更有可能对FindBoost.cmake 模块填充的Boost_INCLUDE_DIRS
变量(注意尾随)感兴趣。S
有关详细信息,请参阅文档。
推荐阅读
- python - 将混合类型的 DataFrame 拆分为两列?
- facebook - 尝试使用 Buffer REST API 将多个图像上传到 Facebook 和 Twitter
- python-3.x - 检查一串单词是否是一个句子
- lua - 将坐标转换为不同的坐标系?
- typescript - 将 typescript 接口映射到相关接口
- scala - 无法初始化类 com.datastax.spark.connector.types.TypeConverter$
- java - Java 最佳实践 - 对象实例化与对 null 的对象引用
- c# - 如何让父窗体知道子窗体已关闭
- arrays - 将数组的内容分组到多个嵌套数组中
- android - Gradle 同步失败:原因:启动失败(基本功能不起作用)