Search code examples
c++boostc++11bjam

How to build Boost with C++0x support?


I don't know how to build Boost with C++0x compilers. Which option must be given to bjam? Should the user.config file be modified?Can someone help me?

Best, Vicente


Solution

  • I have found the answer. I was waiting for a features something like 'std' and call it as follows:

    bjam std=0x
    

    but currently we need to use the low level variables cxxflags and add the specific compiler flags. For example for gcc we can do

    bjam toolset=gcc cxxflags=-std=gnu++0x
    

    Other compilers will need a different setting.

    Waiting for a new Boost.Build feature, you can also define your own toolset as follows: Add the user.config or site.config file

    using gcc
       : std0x
       : "/usr/bin/g++" # your path to the C++0x compiler
       : <cxxflags>-std=gnu++0x
       ;
    

    And now call as

    bjam toolset=gcc-std0x