我使用的是 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/