Boost

# Header-only libraries
hunter_add_package(Boost)
find_package(Boost CONFIG REQUIRED)
target_link_libraries(... Boost::boost)
# Boost components (see list below)
hunter_add_package(Boost COMPONENTS system filesystem)
find_package(Boost CONFIG REQUIRED system filesystem)
target_link_libraries(... Boost::system Boost::filesystem)

Examples:

List of components (other libraries are header-only):

  • atomic
  • chrono
  • context
  • coroutine
  • date_time
  • exception
  • filesystem
  • graph
  • graph_parallel
  • iostreams
  • locale
  • log
  • math
  • mpi
  • program_options
  • python
  • random
  • regex
  • serialization
  • signals
  • system
  • test
  • thread
  • timer
  • wave

Compatibility mode

hunter_add_package(Boost COMPONENTS system filesystem)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED system filesystem)
if(MSVC)
  add_definitions(-DBOOST_ALL_NO_LIB=1)
endif()

include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(... ${Boost_LIBRARIES})

CMake options

CMake options can be passed to boost build using CMAKE_ARGS feature (see customization). Options of special form <COMPONENT-UPPERCASE>_<OPTION>=<VALUE> will be added to b2 as -s <OPTION>=<VALUE> while building component . For example:

hunter_config(Boost VERSION ... CMAKE_ARGS IOSTREAMS_NO_BZIP2=1)
# add NO_BZIP2=1 to the b2 build of iostreams library, i.e. `b2 -s NO_BZIP2=1`

Bugs