Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Differences to Boost.Build V1

Configuration
Writing Jamfiles
Build process

While Boost.Build V2 is based on the same ideas as Boost.Build V1, some of the syntax was changed, and some new important features were added. This chapter describes most of the changes.

Configuration

In V1, there were two methods to configure a toolset. One was to set some environment variable, or use the -s command line option to set a variable inside BJam. Another method was to create a new toolset module that would set the variables and then invoke the base toolset. Neither method is necessary now: the using rule provides a consistent way to initialize a toolset, including several versions. See the section called “Configuration” for details.

Writing Jamfiles

Probably one of the most important differences in V2 Jamfiles is the use of project requirements. In V1, if several targets had the same requirements (for example, a common #include path), it was necessary to manually write the requirements or use a helper rule or template target. In V2, the common properties can be specified with the requirements project attribute, as documented in the section called “Projects”.

Usage requirements also help to simplify Jamfiles. If a library requires all clients to use specific #include paths or macros when compiling code that depends on the library, that information can be cleanly represented.

The difference between lib and dll targets in V1 is completely eliminated in V2. There's only one library target type, lib, which can create either static or shared libraries depending on the value of the <link> feature. If your target should be only built in one way, you can add <link>shared or <link>static to its requirements.

The syntax for referring to other targets was changed a bit. While in V1 one would use:

exe a : a.cpp <lib>../foo/bar ;

the V2 syntax is:

exe a : a.cpp ../foo//bar ;

Note that you don't need to specify the type of other target, but the last element should be separated from the others by a double slash to indicate that you're referring to target bar in project ../foo, and not to project ../foo/bar.

Build process

The command line syntax in V2 is completely different. For example

bjam -sTOOLS=msvc -sBUILD=release some_target

now becomes:

bjam toolset=msvc variant=release some_target

or, using implicit features, just:

bjam msvc release some_target

See the reference for a complete description of the syntax.


PrevUpHomeNext