How to specify header-only boost library for CMake?

1k views Asked by At

I am using the following cmake file

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)

During CMake configure phase it writes

...
[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

Which proves it is finding boost in /opt/boost.

Unfortunately, during compile it says it can't find include file

[build] ../main.cpp:3:10: fatal error: boost/beast.hpp: No such file or directory
[build]  #include <boost/beast.hpp>
[build]           ^~~~~~~~~~~~~~~~~
[build] compilation terminated.

Although, file is there

$ ls /opt/boost/boost/beast.hpp
/opt/boost/boost/beast.hpp

So, how to configure boost for CMake correctly?

0

There are 0 answers