我安装了多个版本的 Boost(Windows 7/MinGW)。我需要使用一个特定的(1.53.0)。
我在 CMakeFiles.txt 文件中定义了 BOOST_ROOT:SET(BOOST_ROOT C:/boost_1_53_0/)
,但我不断收到此错误:
> cmake .
BOOST_ROOT=C:/boost_1_53_0/
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1191 (message):
Unable to find the requested Boost libraries.
Boost version: 1.48.0
Boost include path: C:/Boost/include/boost-1_48
Detected version of Boost is too old. Requested version was 1.53 (or
newer).
The following Boost libraries could not be found:
boost_filesystem
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
我还将 BOOST_ROOT 定义为环境变量,但结果相同。
为什么 cmake 还在寻找旧版本?
最佳答案
如果您使用的是用于 Visual Studio 的 Boost 库的预编译版本,则它们具有特定的 MSVC 版本和位数。我需要将 CMake 指向该特定位置 - 在我的情况下,将 BOOST_ROOT 设置为 C:/local/boost_1_59_0 并将 BOOST_LIBRARYDIR 设置为 C:/local/boost_1_59_0/lib64-msvc-11.0 有帮助。
关于boost - 无法为 cmake 指定 BOOST_ROOT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17108593/