Boost logo

Boost-Build :

From: Bojan Resnik (resnikb_at_[hidden])
Date: 2005-12-12 06:03:24


> > It seems that the PCH doesn't inherit any requirements of the project
> > that uses it, which often makes it invalid.
>
> Is this the correct behaviour?
>
> Consider:
>
> pch stdafx : [ cast _ pcheader : stdafx.h ] stdafx.cpp ;
>
> exe app1 : ... stdafx : <define>HELLO ;
> exe app2 : ... stdafx : <define>WORLD ;
>
> In the above, stdafx would inherit both defines. Would this be the
> required behaviour.

  It should inherit <define>HELLO when building app1, but
<define>WORLD when building app2. The point here is that the
precompiled header must be built with the same requirements as other
files.

> I have not had chance to look into this in depth yet, but the workaround
> to your issue would be to add the arguments to the pch target as well:
>
> exe e : ep e.cpp : <cxxflags>/vmg ;
> pch ep : [ cast _ pcheader : ep.hpp ] ep.cpp : <cxxflags>/vmg ;
>
> - Reece

   This would work if the requirements were to be explicitly specified
for the main target. However, the real problem is with inhertied usage
requirements of another target. An example that is closer to what I
have now would be:

  exe e : ep e.cpp : <use>mylib ;
  pch ep : [ cast _ pcheader : ep.hpp ] ep.cpp ;

  lib mylib : l.cpp : : <cxxflags>/vmg ;

  In the above example, e.cpp builds with /vmg, but the precompiled
header doesn't, making the compiler complain.

--
Bojan Resnik

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