Boost logo

Boost :

Subject: Re: [boost] [Build] Specify compiler on the command line
From: Larry Evans (cppljevans_at_[hidden])
Date: 2015-10-16 12:49:51


On 10/16/2015 10:06 AM, Larry Evans wrote:
> On 10/15/2015 01:24 PM, Andrey Semashev wrote:
>> 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.
> [snip]
>> 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 ;
>>
>>
> In case clang is not in normal places,
> this part of a user-config.jam would work:
>
> using clang
> : 3.7
> : "/home/evansl/dwnlds/llvm/3.7/prebuilt/clang+llvm-3.7.0-x86_64-
> linux-gnu-ubuntu-14.04/bin/clang++"
> : <cxxflags>-std=c++1y
> ;
>
> an the toolset option would be:
>
> b2 --toolset=clang-3.7
>
OOPS. For some strange reason, another <cxxflags>
and also a similar <linkflags> is needed to get
the right stdlib in the link:

using clang
  : 3.7
  :
"/home/evansl/dwnlds/llvm/3.7/prebuilt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++"
  : <cxxflags>-std=c++14
    <cxxflags>-stdlib=libc++
    <linkflags>-stdlib=libc++
  ;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk