How to determine Boost library names for CMake

I am trying to figure out which components for Find in CMakeList.txt for boost libraries.

I looked at this directory /usr/local/include/boost . And I accidentally select some of the folders and try to use FIND_PACKAGE . All of this work well.

 FIND_PACKAGE(Boost COMPONENTS thread system log log_setup signals graph memory_order program_options REQUIRED) 

In particular, I use property_tree . It does not work and causes the following error message:

CMake error in /Applications/CMake.app/Contents/share/cmake-3.1/Modules/FindBoost.cmake:1182 (post):

Unable to find the requested Boost libraries.

Boost version: 1.55.0

Boost includes the path: / usr / local / include

The following static Boost libraries could not be found:

  boost_property_tree 

Can someone explain how and where can I find the correct library names for promotion?

+8
boost cmake
source share
1 answer

The COMPONENTS FIND_PACKAGE searches only compiled libraries. It cannot check libraries only for the headers that make up the bulk of Boost. There are only a few libraries that require linking (mostly those that do platform-specific things).

From your examples, only thread , signals (unlike signals2 , only for the header), system and program_options must be created in advance, and then linked to your program. Otherwise, just include the appropriate header files.

Thus, just add ${Boost_INCLUDE_DIRS} to the include directories of your target.

See the list of libraries for these libraries here. What additional libraries are for header only?

+12
source share

All Articles