...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
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.
In V1, toolsets were configured by environment variables. If you
wanted to use two versions of the same toolset, you had to create a new
toolset module that would set the variables and then invoke the base
toolset. In V2, toolsets are configured by the
using
, and you can easily configure several
versions of a toolset. See the section called “Configuration” for details.
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
.
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.