【发布时间】:2013-06-11 02:37:12
【问题描述】:
我安装了多个版本的 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还在寻找旧版本?
【问题讨论】:
-
请看一下:如何让 cmake 找到我的 boost 安装? stackoverflow.com/questions/3016448/…
-
@Offirmo:不幸的是,我需要在 Windows 7 上构建它。
-
尝试运行
cmake . -DBoost_DEBUG=ON以获取有关 CMake 正在做什么的更多信息。如果在您指定的BOOST_ROOT路径中找不到合适的 boost 版本,它将继续在系统文件夹中查找。 1.53 版本可能不适合,例如如果您将 boost 编译到共享库中,但在您的 CMakeLists.txt 中您没有指定set(Boost_USE_STATIC_LIBS OFF)。 -
@Fraser:在我的 CMakeLists.txt 文件中,我有:
SET(Boost_USE_STATIC_LIBS ON)和SET(Boost_USE_STATIC_RUNTIME ON)。 -
@Pietro - 这只是可能出错的一个例子。如果您粘贴运行
cmake . -DBoost_DEBUG=ON的输出并提供boost 1.53 库的全名(这些名称通常会提供有关如何构建库的大量信息),则最容易调试
标签: boost cmake version environment-variables