CMake 上的 Boost_DIR-NOTFOUND

标签 boost cmake

我在尝试使用 CMake 配置项目时遇到了一些问题。

尽管 CMake 似乎找到了所需的库:

Boost version: 1.49.0
Found the following Boost libraries:
  system
  thread
  chrono

它仍然找不到它的根目录:

Boost_DIR-NOTFOUND

我正在使用 Linux Mint 15 (Olivia)。提前致谢。

最佳答案

如果要检查搜索是否成功,则需要检查变量 Boost_FOUND

find_package(Boost [...])
if(NOT Boost_FOUND)
  message(FATAL_ERROR "Could not find boost!")
endif()

Boost_DIR 变量仅在使用 Boost 的包配置文件时才有意义(从 Boost 1.54 开始不再支持该文件)。因此,如果 find 调用将此值保留在 NOTFOUND 状态,则完全没有问题。

参见 documentation了解详情。

关于CMake 上的 Boost_DIR-NOTFOUND,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18927970/

相关文章:

c++ - boost::multi_array 调整大小异常?

c++ - 如何在 pkg-config 中使用 C++ Boost 库?

c++ - boost::accumulators::rolling_mean 返回不正确的平均值

c++ - 链接 Boost 线程库

cmake - 强制串行执行 CMake 中的特定目标

CMake:C11 的 CMakeLists

ios - 使用 Cmake for iOS 查找 boost 框架

c++ - 带 malloc 和 free 的 shared_ptr

cmake - 在 Visual Studio Online 托管代理上使用 CMake 构建

c++ - LNK2038、MSVS2017 MAGMA成因列表