I'm trying to connect the boost asio libraries to my project. But I run into a problem when configuring Imported targets and dependency information not available for Boost version
Two days googled this problem, but failed to solve. I just start working with C ++. New cmake warning about BOOST
I understood that Boost 1.65 and 1.65.1 require CMake 3.9.3 or newer. However, updating cmake to 3.12.1 does not produce results.
Please help or tips in this matter.
System: Ubuntu 18.04 libboost: 1.65.1.0ubuntu1 cmake version 3.12.1 (updated)
Simple Project Code
#include <iostream> #include <boost/asio.hpp> int main() { std::cout << "Hello, World!" << std::endl; boost::asio::ip::tcp::iostream stream("google.com", "http"); stream << "GET /ip HTTP/1.1\r\nHost: google.com\r\nConnection: closer\n\r\n"; std::cout << stream.rdbuf(); return 0; } CMakeList.txt
cmake_minimum_required(VERSION 3.12) project(ticker) set(CMAKE_CXX_STANDARD 11) set (BOOST_ROOT "/usr/lib/x86_64-linux-gnu/") set (Boost_NO_SYSTEM_PATHS ON) set (Boost_USE_MULTITHREADED ON) set (Boost_USE_STATIC_LIBS ON) set (Boost_USE_STATIC_RUNTIME OFF) set (BOOST_ALL_DYN_LINK OFF) find_package (Boost REQUIRED COMPONENTS system filesystem) if (Boost_FOUND) include_directories (SYSTEM ${Boost_INCLUDE_DIR}) endif () add_executable(ticker main.cpp) target_link_libraries (ticker ${Boost_LIBRARIES}) When I try to compile, I get the following
cmake ticker -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning at /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:577 (message): Imported targets and dependency information not available for Boost version (all versions older than 1.33) Call Stack (most recent call first): /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:959 (_Boost_COMPONENT_DEPENDENCIES) /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:1618 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:14 (find_package) CMake Warning at /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:577 (message): Imported targets and dependency information not available for Boost version (all versions older than 1.33) Call Stack (most recent call first): /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:959 (_Boost_COMPONENT_DEPENDENCIES) /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:1618 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:14 (find_package) CMake Error at /opt/cmake-3.12.1-Linux-x86_64/share/cmake-3.12/Modules/FindBoost.cmake:2044 (message): Unable to find the requested Boost libraries. Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers. Call Stack (most recent call first): CMakeLists.txt:14 (find_package) -- Configuring incomplete, errors occurred! See also "/home/ivan/Projects/CMakeFiles/CMakeOutput.log".