How to determine the Boost library names for CMake

后端 未结 2 1279
南旧
南旧 2020-12-28 15:25

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

I looked at this directory /usr/local/include/

相关标签:
2条回答
  • 2020-12-28 15:38

    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?

    0 讨论(0)
  • 2020-12-28 15:39

    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

    0 讨论(0)
提交回复
热议问题