3

我正在尝试使用 Beast 制作一个 CMake 项目,并且它已从源代码正确安装/usr/local/include/boost,但我无法让 CMake 找到它。我虽然它可能是一个3.10.2,所以我累了3.11.43.12.0-rc1但都没有工作。有谁知道该怎么做?

环境:Windows CLion 2018.1.5 和 WSL 上的 Ubuntu 18.04LTS。

尝试运行 CMake 时,出现以下错误:

CMake Warning at /home/aidan/Apps/cmake-3.11.4-Linux-x86_64/share/cmake-3.11/Modules/FindBoost.cmake:1723 (message):
  No header defined for beast; skipping header check
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


CMake Error at /home/aidan/Apps/cmake-3.11.4-Linux-x86_64/share/cmake-3.11/Modules/FindBoost.cmake:2044 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.67.0

  Boost include path: /usr/local/include

  Could not find the following Boost libraries:

          boost_beast

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)
4

1 回答 1

5

Boost beast是一个只有头文件的库。find_package(Boost COMPONENTS ...)在调用中不得引用仅标头库。所以beastfind_package(Boost COMPONENTS ... REQUIRED)通话中删除。

要了解 Boost 库是否只是标头,请查看以下Boost 页面

于 2018-06-21T15:06:43.357 回答