Index of Boost cmake components

Viewed 351

I am using boost quite often, but every time I try to use it I have doubts about what is the name of Boost module, which I should add in cmake.

For example in my last project I wanted to use boost::concurrent::sync_queue and I can't find anywhere what is the name of the module. I finally found it by accident, by locating random github project that already using it, so I just look into CMakeLists.txt.

At the end I got that line: find_package(Boost 1.70 REQUIRED COMPONENTS thread ) But first i've tried:

find_package(Boost 1.70 REQUIRED COMPONENTS concurrent )
find_package(Boost 1.70 REQUIRED COMPONENTS threading )
find_package(Boost 1.70 REQUIRED COMPONENTS threads )

And as I remember in all of my project this is one of most frustrating phase of cmake. I found this site but there is only avaiable flags/options in cmake.

Do any of you have set/list/index or tip how to link used class/functionallity from boost to required component? If such index has relation to boost version it would be priceless and really handy.

1 Answers

From CMake\share\cmake-3.*\Modules\FindBoost.cmake:

FindBoost
---------

Find Boost include dirs and libraries

Use this module by invoking find_package with the form::

  find_package(Boost
    [version] [EXACT]      # Minimum or EXACT version e.g. 1.67.0
    [REQUIRED]             # Fail with error if Boost is not found
    [COMPONENTS <libs>...] # Boost libraries by their canonical name
                           # e.g. "date_time" for "libboost_date_time"
    [OPTIONAL_COMPONENTS <libs>...]
                           # Optional Boost libraries by their canonical name)
    )                      # e.g. "date_time" for "libboost_date_time"

It says to use:

Boost libraries by their canonical name e.g. "date_time" for "libboost_date_time"

Related