c++ - Cmake 找不到 Boost 文件夹

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

我使用的是 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\ 但我还是明白了。我该如何解决这个问题。

最佳答案

将 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。

关于c++ - Cmake 找不到 Boost 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12887228/

相关文章:

c++ - 有没有 C++ 函数可以对 Map 进行排序?

C++——为什么我可以为类 Month 返回一个 int

c++ - MSVC10/MP 在项目中跨文件夹构建非多核

c++ - 带有 boost ublas 的常数矩阵

c++ - 与遗留 TCHAR 代码接口(interface)的正确样式

c++ - 多维数组逻辑

windows - 如何使用 procdump -t -- 在进程终止时转储?

c++ - sizeof 没有返回正确大小的 LPVOID 变量

c++ - Boost/Python 有 make_array 方法吗?

c++ - 使用 MinGW gcc 4.4.0 boost thread_interrupted 异常终止(),3.4.5 OK