I am trying to figure out what components to Find
in CMakeList.txt for boost
libraries.
I looked at this directory /usr/local/include/
The COMPONENTS
part of FIND_PACKAGE
only searches for compiled libraries. It is not able to check for the header-only libraries that comprise a major part of Boost. There are only a few libraries that require linking (mostly those that perform platform-specific things).
From your examples, only thread
, signals
(in contrast to signals2
which is header-only), system
and program_options
need to be build beforehand and then linked with your program. For the rest, it is sufficient to include the relevant header files .
Thus, it is sufficient to add ${Boost_INCLUDE_DIRS}
to the include directories of your target.
See here for a list of libraries of these libraries Which boost libraries are header-only?
If boost library is compiled, then component name is basically lowercase name of library without prefixes and suffixes (for example for boost_system-vc141-mt-x64-1_66.lib it would be 'system')
Also see here: https://cmake.org/cmake/help/v3.10/module/FindBoost.html