Boost logo

Boost-Build :

Subject: [Boost-build] gcc precompiled headers
From: Jeroen van der Wulp (J.v.d.Wulp_at_[hidden])
Date: 2008-11-16 12:25:35

Hello everyone,

I'm still looking at precompiled headers and I found another small
issue. At some point it all seemed to work but today I found that the
names of precompiled headers should be of the form x.hpp.gch for a
header file x.hpp. With the Boost trunk version of Boost Build I am
getting x.gch which I thought to be okay for some time.

The comment in gcc.jam suggests that it was once working this way:

# Calls the base version specifying source's name as the name of the created
# target. As result, the PCH will be named whatever.hpp.gch, and not
# whatever.gch.
rule generated-targets ( sources + : property-set : project name ? )

I prepared a small patch that solved the problem for me. Although it
solves the problem it feels like a hack. Maybe someone more knowledgable
can have a quick look.

Another problem I'm having is that I'm importing precompiled headers in
library sources files as well as source files for executables. The
differences between the two in my case are the setting of the -fPIC
flag. The precompiled header cannot be used by both.

Can I also solve this problem by setting -fpic for all compilations in
the project? For what platforms/gcc versions can this work and does this
have any unwanted side-effects? On the other hand I was wondering
whether an position independent code feature might help with this.



Index: tools/build/v2/tools/gcc.jam
--- tools/build/v2/tools/gcc.jam (revision 49796)
+++ tools/build/v2/tools/gcc.jam (working copy)
@@ -281,7 +281,7 @@
         name = [ $(sources[1]).name ] ;
         return [ generator.generated-targets $(sources)
- : $(property-set) : $(project) $(name) ] ;
+ : $(property-set) : $(project) $(name)$(name:S) ] ;

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