Using boost.asio in cMake

I am relatively new to cMake, and I am trying to use the boost asio library in my project.

I managed to get cMake to find other boost libraries like smart_ptr and lexical_cast, but I get a linker error when I try to include boost/asio.hpp:

LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-1_40.lib'.  

Then I tried to change my CMakeLists.txt from

find_package(Boost 1.40.0 REQUIRED)

to

find_package(Boost 1.40.0 REQUIRED COMPONENTS asio)

cMake then requests Boost_ASIO_LIBRARY_DEBUGand Boost_ASIO_LIBRARY_RELEASE. I am going to do it right, and if so, where should I tell cMake to find these libraries. (I am using cMake 2.6 and raising 1.40.0)

+5
source share
1 answer

According to ASIO documentation:

To communicate programs using Boost.Asio:

:
  • Boost.System boost:: system:: error_code boost:: system:: system_error.
  • Boost.Regex(), - read_until() async_read_until(), boost:: regex.
  • OpenSSL (), Boost.Asio SSL.

, , Boost.System. CMakLists.txt, :

find_package(Boost 1.40.0 REQUIRED system)
+8

All Articles