Boost logo

Boost-Build :

Subject: Re: [Boost-build] How do I pass cxxflags to Boost libraries from within my jamfile?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-10-29 11:00:48


On 10/28/2013 04:01 PM, Foster Brereton wrote:
> (Repeating a question I posted on Stackoverflow:
> I have a project with some requirements, one of which is to set the c++11
> compiler/linker flags:
> jamroot.jam:
> project
> : requirements
> <toolset>clang:<cxxflags>"-stdlib=libc++ -std=c++11"
> <toolset>clang:<linkflags>"-lc++"
> # ... etc
> ;
> lib mylibrary
> : #sources
> [ glob source/*.cpp ]
> /boost/filesystem
> /boost/system
> /boost/thread//boost_thread
> ;
> The library-specific sources are being compiled with the necessary c++11 flags,
> however the Boost libraries mentioned do not. This is causing no end of binary
> incompatibilities and linker errors.
> I do not want to specify the cxxflags explicitly in either the user-config or
> the command line. I would like to make sure the jamroot/jamfiles are all that is
> necessary to build the project properly.
> How do I "pass in" the desired cxxflags to the dependent Boost libraries?
> Also: I recently tried using an alias to accomplish my goal. From the docs:
> Another use of the alias rule is to change build properties. For example, if
> you want to use link statically to the Boost Threads library, you can write
> the following:
> alias threads : /boost/thread//boost_thread : <link>static ;
> However setting this up for boost_filesystem and rebuilding, say, path.cpp still
> omits the properties I am trying to build with.
> What am I missing?

This only works for propagated features.
Create a composite feature that collects
all the properties that you want.

import feature ;
feature.feature myoptions : on : composite optional propagated ;
feature.compose <myoptions>on : <toolset>clang:... ;

Then when you use <myoptions>on, it will automatically
be passed on the dependencies.

In Christ,
Steven Watanabe

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at