Привет всем.
Пытаю подключить библиотеки boost asio к своему проекту. Но сталкиваюсь с проблемой при конфигурировании
Imported targets and dependency information not available for Boost version
Два дня гуглил эту проблему, но решить так и не удалось. С C++ только начинаю работать.
New cmake warning about BOOSTCMake finds Boost but the imported targets not ava...
Понял что Boost 1.65 and 1.65.1 require CMake 3.9.3 or newer. Однако обновление cmake до 3.12.1 не дает результатов.
Прошу помощи или подсказки в этом вопросе.
Система: Ubuntu 18.04
libboost: 1.65.1.0ubuntu1
cmake version 3.12.1 (обновил)
Код простого проекта
#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})
При попытке компиляции я получаю следующее
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".