Boost logo

Boost-Build :

Subject: Re: [Boost-build] Passing <cxxflags>-fPIC with use-project /boost
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-05-07 12:05:17


Michael Weber wrote:

> On Thu, May 7, 2009 at 8:08 AM, Vladimir Prus <ghost_at_[hidden]> wrote:
>>
>> On Thursday 07 May 2009 14:07:30 Martin Dyring-Andersen wrote:
>> > Hello everybody,
>> >
>> > I have a Jamroot that looks like this:
>> >
>> > project       :       requirements
>> > <threading>multi
>> > <toolkit>gcc,<address-model>64:<cxxflags>-fPIC
>> > :       build-dir stage
>> > :       default-build release
>> > ;
>> >
>> > use-project /boost    : dependencies/boost_1_39_0 ;
>> > use-project /test     : test ;
>> >
>> > and a Jamfile located in test subdirectory that looks like this:
>> >
>> > lib test      :       [ glob-tree *.cpp ]
>> > /boost//thread/<link>static
>> > /boost//date_time/<link>static
>> > ;
>> >
>> > Now, to get the static linking to /boost//thread and date_time working I need to pass -fPIC
>> > when building with GCC on 64 bit platforms.
>> >
>> > I can see that my own targets in lib sfcg gets compiled with -fPIC, but for some reason the
>> > /boost//thread and date_time libraries does not seem to "notice" it.
>> >
>> > Everything will work perfectly if I pass cxxflags=-fPIC as a parameter to bjam on the command
>> > line. But I would prefer to cram as many details as possible into the Jamfiles, so I don't have
>> > to remember them later on ;-).
>>
>> cxxflags is so called "free" feature -- which is feature which value is not
>> interpreted. Such features are not propagated to dependencies, for various
>> reasons. So, you have to use something like:
>>
>> /boost//thread/<link>static/<cxxflags>-fPIC
>>
>> - Volodya
>
> Is this really a case of propagating across dependencies? The flags
> are specified in a Jamroot file, and not on the lib target itself.

But Boost library targets, presumably, are under separate Jamroot.

>
> I have a similar setup as Martin, with a Jamroot in a high level
> directory setting cxxflags for my entire project, and projects in
> subdirectories depending upon each other. e.g., subproject B depends
> upon A, and when I build B, the cxxflags specified in Jamroot for the
> whole project are passed to both subprojects A and B during the build.
>
> It is possible that the Jamroot file in the boost project folder is
> hiding Martin's cxxflags. When analyzing the boost project jamfiles,
> jam will stop at the first Jamroot file it finds when traversing up
> the folder hierarchy, and boost has its own. In fact, I use that
> behaviour to occasionally override the cxxflags as specified in my own
> Jamroot for subprojects that require exceptions to otherwise globally
> applicable settings.

It's not much of 'hiding', it's just Boost and Martin's project have
different Jamroot, so settings in one do not affect settings in
the other.

- Volodya


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk