CMake 发现 Boost 但未设置 Boost_INCLUDE_DIR
CMake finds Boost but Boost_INCLUDE_DIR is not set
我正在尝试使用 Boost 的源代码构建版本在 CentOS 5 上构建一个 CMake 项目。我在 /tmp/boost/boost_1_74_0
中安装了 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
。这可能是什么问题?
这是当我还指定 -DBoost_DEBUG=ON
:
时 CMake 输出的内容
-- 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
)感兴趣。有关详细信息,请参阅 documentation。
我正在尝试使用 Boost 的源代码构建版本在 CentOS 5 上构建一个 CMake 项目。我在 /tmp/boost/boost_1_74_0
中安装了 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
。这可能是什么问题?
这是当我还指定 -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
)感兴趣。有关详细信息,请参阅 documentation。