【问题标题】:Cmake can't find Boost FolderCmake找不到Boost文件夹
【发布时间】:2012-10-14 22:36:37
【问题描述】:

我正在使用 Windows 7 - 64 位,并且正在尝试构建一个项目。当我使用 cmake 时出现错误

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos
t.cmake:1191 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  src/CMakeLists.txt:310 (find_package)


CMake Error at src/CMakeLists.txt:312 (message):
  Boost C++ libraries not found.  Please install or try setting BOOST_ROOT

我已将变量 BOOST_ROOT 设置为 D:\MyProject\boost_1_43_0\boost\ 但我还是明白了。我该如何解决这个问题。

【问题讨论】:

  • 我的猜测 - 删除 CMakeCache.txt 并再次重新运行 cmake。有时它会有所帮助。
  • 如果您使用的是CMake GUI,需要在设置BOOST_ROOT后再次点击“配置”。
  • 不应该将BOOST_ROOT 设置为 D:/MyProject/boost_1_43_0,因为那是“包含 Boost 的目录”?

标签: c++ visual-c++ boost cmake


【解决方案1】:

将 boost 放在项目的子文件夹中并不是 CMake 定位 boost 的标准做法。我在 Program Files 中安装了 boost x64 - MSVC 2010,CMake 会自动找到它。

Boost_DIR : C:/Program Files/Boost/share/cmake/boost
Boost_INCLUDE_DIR : C:/Program Files/Boost/include

您也可以尝试在系统环境变量级别设置 Boost_DIR。

【讨论】:

    猜你喜欢
    • 2011-04-18
    • 2011-12-26
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多