This is the reference page for the B2, aka Boost Build, generator. It is a multi-generator to match the multi-build nature of B2.


This is an experimental feature subject to breaking changes in future releases.


# Use release dependencies:
$ conan install -g b2 -s build_type=Release ...
# Optionally, also use debug dependencies:
$ conan install -g b2 -s build_type=Debug ...
# And so on for any number of configurations you need.

The commands will generate 3 files:

  • conanbuildinfo.jam: Which includes the other two, and enables its use.

  • conanbuildinfo-XXX.jam: Variables and targets adjusted only for build_type Release, where XXX is a key indicating the full variation built.

  • conanbuildinfo-YYY.jam: Variables and targets adjusted only for build_type Debug, where YYY is a key indicating the full variation built.

Sub-projects in conanbuildinfo-XXX.jam

The B2 generator defines sub-projects relative to the location of the B2 project you generate the conan configuration. For each package a sub-project with the package name is created that contains targets you can use as B2 sources in your projects.

For example with this conanfile.txt:



You would get three sub-projects defined relative to the conanfile.txt location:

project clara ;
project boost_predef ;
project zlib ;

For a root level project those could be referenced with an absolute project path, for example /clara. Or you can use relative project paths as needed, for example ../clara or subproject/clara.

Targets in conanbuildinfo-XXX.jam

For each package a target in the corresponding package subproject is created that is specific to the variant built. There is also a general libs target that is an alias to all the package library targets. For header only packages this libs target would not contain references to the package libraries as they do not exist. But it would still contain the rest of the Usage requirements for you to make use of the headers in that package. For example, for the above conanfile.txt the targets would be..

clara subproject:

alias libs
    : # source, none as it's header only
    : # requirements specific to the build
    : # default-build
    : # usage-requirements

Where ... contains references to the variant specific constants. The target for boost_predef is equivalent as that’s also a header only library. For libz it contains a built linkable library and hence it has additional targets for that.

libz subproject:

alias z
    : # source, no source as it's a searched pre-built library
    : # requirements
      # rest of the requirements specific to the build
    : # default-build
    : # usage-requirements

alias libs
    : # source
    : # requirements specific to the build
    : # default-build
    : # usage-requirements

Constants in conanbuildinfo-XXX.jam

This generator also defines constants, and path constants, in the project where the conanfile.txt is located. The constants define variant specific variables for all the packages and a transitive conan set of constants for all the packages.

  • Per package constants

For each requirement conanbuildinfo-XXX.cmake file declares the following constants. variation is the name of the package and variation. That YYY variation takes the form of a comma separated list of: package name, address-model, architecture, target-os, toolset with version, and variant (debug, release, relwithdebinfo, and minsizerel). All are lower case and use the values of the corresponding B2 features. For example a boost_predef package dependency when building with apple-clang 9.0 and debug would be: boost_predef,64,x86,darwin,clang-9.0,debug.




Abs path to root package folder.


Header’s folders


Library folders (default {rootpath}/lib)


Library defines


CXX flags


Shared link flags


C flags


B2 requirements


B2 usage requirements

Both the requirements and usage-requirements are synthesized from the other constants.

  • Global declared constants

The generator also defines a corresponding set of constants that aggregate the values of all the package requirements. The constants for this are the same as the package-specific ones but with “conan” as the name of the project.

  • Constants from user_info

If any of the requirements is filling the user_info object in the package_info method a set of constants will be declared following this naming:




User declared value

variation is the package and variant as above and name the variable name in lower case. For example:

class MyLibConan(ConanFile):
    name = "MyLib"
    version = "1.6.0"

    # ...

    def package_info(self):
        self.user_info.var1 = 2

When other library requires MyLib and uses the B2 generator:


constant user(var1,mylib,...) : "2" ;