Boost C++ Libraries

PrevUpHomeNext

Builtin rules

This section contains the list of all rules that can be used in Jamfile—both rules that define new targets and auxiliary rules.

exe

Creates an executable file. See the section called “Programs”.

lib

Creates an library file. See the section called “Libraries”.

install

Installs built targets and other files. See the section called “Installing”.

alias

Creates an alias for other targets. See the section called “Alias”.

unit-test

Creates an executable that will be automatically run. See the section called “Testing”.

compile, compile-fail, link, link-fail, run, run-fail

Specialized rules for testing. See the section called “Testing”.

check-target-builds

The check-target-builds allows you to conditionally use different properties depending on whether some metatarget builds, or not. This is similar to functionality of configure script in autotools projects. The function signature is:

rule check-target-builds ( target message ? : true-properties * : false-properties * )
        

This function can only be used when passing requirements or usage requirements to a metatarget rule. For example, to make an application link to a library if it's available, one has use the following:

exe app : app.cpp : [ check-target-builds has_foo "System has foo" : <library>foo : <define>FOO_MISSING=1 ] ;
        

For another example, the alias rule can be used to consolidate configuration choices and make them available to other metatargets, like so:

alias foobar : : : : [ check-target-builds has_foo "System has foo" : <library>foo : <library>bar ] ;
        
obj

Creates an object file. Useful when a single source file must be compiled with special properties.

preprocessed

Creates an preprocessed source file. The arguments follow the common syntax.

glob

The glob rule takes a list shell pattern and returns the list of files in the project's source directory that match the pattern. For example:

lib tools : [ glob *.cpp ] ;
        

It is possible to also pass a second argument—the list of exclude patterns. The result will then include the list of files matching any of include patterns, and not matching any of the exclude patterns. For example:

lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ;
        

glob-tree

The glob-tree is similar to the glob except that it operates recursively from the directory of the containing Jamfile. For example:

ECHO [ glob-tree *.cpp : .svn ] ;
        

will print the names of all C++ files in your project. The .svn exclude pattern prevents the glob-tree rule from entering administrative directories of the Subversion version control system.

project

Declares project id and attributes, including project requirements. See the section called “Projects”.

use-project

Assigns a symbolic project ID to a project at a given path. This rule must be better documented!

explicit

The explicit rule takes a single parameter—a list of target names. The named targets will be marked explicit, and will be built only if they are explicitly requested on the command line, or if their dependents are built. Compare this to ordinary targets, that are built implicitly when their containing project is built.

always

The always function takes a single parameter—a list of metatarget names. The top-level targets produced by the named metatargets will be always considered out of date. Consider this example:

exe hello : hello.cpp ;
exe bye : bye.cpp ;
always hello ;

If a build of hello is requested, then the binary will always be relinked. The object files will not be recompiled, though. Note that if a build of hello is not requested, for example you specify just bye on the command line, hello will not be relinked.

constant

Sets project-wide constant. Takes two parameters: variable name and a value and makes the specified variable name accessible in this Jamfile and any child Jamfiles. For example:

constant VERSION : 1.34.0 ;
        

path-constant

Same as constant except that the value is treated as path relative to Jamfile location. For example, if b2 is invoked in the current directory, and Jamfile in helper subdirectory has:

path-constant DATA : data/a.txt ;
        

then the variable DATA will be set to helper/data/a.txt, and if b2 is invoked from the helper directory, then the variable DATA will be set to data/a.txt.

build-project

Cause some other project to be built. This rule takes a single parameter—a directory name relative to the containing Jamfile. When the containing Jamfile is built, the project located at that directory will be built as well. At the moment, the parameter to this rule should be a directory name. Project ID or general target references are not allowed.

test-suite

This rule is deprecated and equivalent to alias.


PrevUpHomeNext