Boost logo

Boost-Build :

From: Bojan Resnik (resnikb_at_[hidden])
Date: 2005-12-07 08:40:13


Consider the following Jamfile:

-------
import cast ;

exe e : ep e.cpp : <cxxflags>/vmg ;
pch ep : [ cast _ pcheader : ep.hpp ] ep.cpp ;
-------

The compiler commands that bjam executes are:

-----
    call "D:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" >nul
cl /Zm800 -nologo -TP /Z7 /Od /Ob0 /W4 /GR /MDd /GB /EHs
@"bin\msvc-6\debug\ep.obj.rsp" -c -Fo"bin\msvc-6\debug\ep.obj"
/Yc"ep.hpp" /Yl__bjam_pch_symbol -Fp"bin\msvc-6\debug\ep.pch"

    call "D:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" >nul
cl /Zm800 -nologo -TP /Z7 /Od /Ob0 /W4 /GR /MDd /GB /EHs /vmg
@"bin\msvc-6\debug\e.obj.rsp" -c -Fo"bin\msvc-6\debug\e.obj"
-Yu"ep.hpp" -Fp"bin\msvc-6\debug\ep.pch"
-------

The precompiled header is compiled without the /vmg compiler switch,
while the source file is correctly compiled with it.

This problem occurs on a larger scale when the main project references
libraries with usage requirements. These are automatically added to
the main project, but not to the PCH, resulting in PCH compiled with
different compiler settings and defines than other source files in the
project.

It seems that the PCH doesn't inherit any requirements of the project
that uses it, which often makes it invalid.

--
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