boost - 无法为 cmake 指定 BOOST_ROOT

标签 boost cmake version environment-variables

我安装了多个版本的 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/

相关文章:

c++ - 使用没有 boost 指针的 STL 容器

c++ - boost T_CONTLINE token 不起作用

c++ - Boost XML 基于 class_id 的反序列化

boost - 如何通过boost::interprocess在向量中构造向量

makefile - 在Cmake中运行自定义命令

sqlite - 我如何知道 db 文件的 sqlite 版本和密码?

c++ - 解决正交模块的依赖关系

c++ - 验证我对 CMakeLists.txt 文件的理解

c# - 按字符串排序列表以查找较新版本 C#

java - 您如何告诉 Hibernate 您的实体类映射采用 JPA 1.0 语法?