Differences to Boost.Build V1

| Home | Libraries | People | FAQ | More

## Differences to Boost.Build V1

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 is to set some environment variable, or use "-s" command line option to set variable inside BJam. Another method was creating new toolset module, which would set the variables and then invoke basic toolset. Neither method is necessary now, the "using" rule provides a consistent way to initialize toolset, including several versions. See section on configuraton for details.

### Writing Jamfiles

Probably one of the most important differences in V2 Jamfiles is the project requirements. In V1, if several targets have the same requirements (for example, common include path), it was necessary to manually write that requirements, or use a helper rule. In V2, the common properties can be specified with the "requirements" project attribute, as documented here.

The usage requirements is also important mechanism to simplify Jamfile. If a library requires all clients to use specific includes, or macros when compiling the code which depends on the library, this information can be cleanly represented.

The difference between "lib" and "dll" targets in V1 is completely eliminated in V2. There's only one target -- "lib", which can create either static or shared library depending on the value of the <link> feature. If your target should be only build in one variant, you can add <link>shared or <link>static to 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 to 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 shortcuts, just:

    bjam msvc release some_target

See the reference for complete description of the syntax.