Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-08-08 04:35:32


On Friday 05 August 2005 01:00, emildotchevski wrote:
> > rule simple-lib ( lib-name )
> > {
> > lib $(lib-name) : [ glob *.cpp ] [ glob $(OS)/*.cpp ;
> > }
>
> I tried putting the above in project-root.jam, but i get this error:
>
> project.jam:321 in load-jamfile from module project
> error: The value of the .current-project variable
> error: has magically changed after loading a Jamfile.
> error: This means some of the targets might be defined a the wrong
> project.

As a side remartk, please don't use project-root.jam at all. Top-level file
should be called Jamroot, and other files should be called Jamfile.

What you observe is indeed a bug! I've tested rules in project root that
define targets, but did not test the glob rule in that context, and it was
broken. A fix and a test were just committed.

> And finally another question, I know the FAQ explains how to set
> compiler flags per cpp file, however what I need is a bit more
> complicated. I want a lib to glob for *.cpp and use common options
> for all of them except for a few files which I need to NOT use a
> compiler flag that all other cpp files use (in the particular case I
> am addressing at the moment, I want to force ANSI conformance for all
> cpp files except for the very few that happen to #include
> <windows.h>).

You'd need some code:

local files = [ glob *.cpp ] ;
local excluded = foo.cpp ;
local objs ;
for local f in $(excluded)
{
objs += [ obj $(f:B) : $(f) : ....... ] ;
}
import set ;
exe whatever : [ set.difference $(files) : $(excluded) ] $(objs) : ..... ;

HTH,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 

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