Boost logo

Boost :

Subject: Re: [boost] [Build] Specify compiler on the command line
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-10-15 14:24:04

On 15.10.2015 21:13, Louis Dionne wrote:
> Hi,
> Still attempting to setup Boost.Build for Hana, I find myself unable to
> specify the compiler to be used by `b2` on the command line. The system
> compiler is then used by default, which does not work because I need to
> test on recent compilers.
> This can be handled by writing a project-config.jam file with the following
> in it:
> import feature ;
> if ! clang in [ feature.values <toolset> ]
> {
> using clang : : /path/to/clang ;
> }
> However, this is not very script-friendly, and I wonder whether there's a way
> to specify it on the command-line instead.

You can use the --toolset option:

bjam --toolset=gcc ...
bjam --toolset=gcc-4.7 ...
bjam --toolset=clang ...

Bjam will look for different versions of compilers installed on the
system and invoke the proper compiler based on the toolset name. You
only have to have lines like these in your user-config.jam:

using gcc ;
using clang ;

Boost list run by bdawes at, gregod at, cpdaniel at, john at