Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-10-08 12:33:29


Johan Nilsson wrote:

> Vladimir Prus wrote:
>> On Friday 05 October 2007 10:25:03 Johan Nilsson wrote:
>>> Hi,
>>>
>>> after attempting to use precompiled headers toghether with gcc
>>> 4.1.2, I figured I might as well post my "findings" here.
>>>
>>> Pre-4.2.0 gcc can't handle pch and anonymous namespaces in headers,
>>> ref: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29085
>>>
>>> This makes it virtually impossible to use pch toghether with e.g.
>>> Boost.Lambda, Boost.Parameter to build programs with multiple
>>> translation units.
>>>
>>> Perhaps a note of this could be added to the BBv2 pch docs?
>>
>> Possibly, thanks for letting know.
>
> Also, it seems like the base name of the pch header needs to be exactly
> the same as the pch target name. Does the provided example (in the docs)
> really work?

I believe it was tested on msvc when added; I should be able to test
myself today or tomorrow.
 
>>> Also - is it possible to disable pch using conditional requirements,
>>> making the pch rule effectively returning a "null" target?
>>
>> The <pch>off feature will have that effect.
>
> Thanks. However, adding <toolset>gcc:<pch>off to my root project
> properties caused everything to rebuild as /pch-off/ was added to the
> target paths. Not much to do about it I guess, but annoying nevertheless.

Well, I guess that, assuming compiler has no bugs, PCH should not change
the generated code, and therefore need not be represented in path.
Does changing

# control precompiled header (PCH) generation
feature.feature pch :
    on
    off
  : propagated
  ;

to

# control precompiled header (PCH) generation
feature.feature pch :
    on
    off
  : propagated incidental
  ;

in pch.jam fixes this annoyance?
 
> Is there possibly a way to obtain the effect of the imagined conditional
> requirement "<toolset>gcc,<toolset-version-below>4.2.0:<pch>off" without
> resorting to indirect conditional requirements?

No.

> One final point: Inside the pch target definition, I also setup the path
> to the pch header as an <include> requirement as I have multiple levels of
> source directories within the project. As a result of this, when turning
> off pch, the source files fails to compile (they no longer find the actual
> pch header file).
>
> Do you have any suggestions for how to handle the above in a generic,
> clean way?

Add the same include as usage requirement on the target?

- 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