我正在使用以下 cmake 文件
cmake_minimum_required(VERSION 3.16)
project(Translated01)
find_package(Boost REQUIRED)
find_package(OpenSSL REQUIRED)
set(CMAKE_CXX_STANDARD 14)
add_executable(Translated01 main.cpp)
在 CMake 配置阶段它写
...
[cmake] -- Check for working CXX compiler: /usr/bin/g++-7 - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Found Boost: /opt/boost (found version "1.73.0")
[cmake] -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1")
[cmake] -- Configuring done
[cmake] -- Generating done
这证明它boost
在/opt/boost
.
不幸的是,在编译期间它说它找不到包含文件
[build] ../main.cpp:3:10: fatal error: boost/beast.hpp: No such file or directory
[build] #include <boost/beast.hpp>
[build] ^~~~~~~~~~~~~~~~~
[build] compilation terminated.
虽然,文件在那里
$ ls /opt/boost/boost/beast.hpp
/opt/boost/boost/beast.hpp
boost
那么,如何CMake
正确配置呢?