I've installed Boost using this command
sudo apt-get install libboost-all-dev
and I wrote this simple example in main.cpp
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main()
{
boost::asio::io_service io;
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.wait();
std::cout << "Hello, world!" << std::endl;
return 0;
}
And in my CMakeLists.txt I have this:
cmake_minimum_required(VERSION 2.8)
find_package(Boost REQUIRED)
if(NOT Boost_FOUND)
message(SEND_ERROR "Failed to find Boost")
return()
else()
include_directories(${Boost_INCLUDE_DIR})
endif()
add_executable(main main.cpp)
CMake worked correctly, but after launching with make I got a few errors:
main.cpp:(.text+0x11f): undefined reference to `boost::system::generic_category()'
How to correctly include boost in my CMakeLists.txt so that cmake will find libraries ?