Boost logo

Boost-Build :

From: Zbynek Winkler (zw-bjam_at_[hidden])
Date: 2004-09-08 14:49:20

Larry Evans wrote:

>>When I say it, I thought -- great! Only to later find out that the
>>following does not work:
>> unit-test a : a.cpp a-test.cpp ;
>> unit-test b : b.cpp a.cpp b-test.cpp : <dependency>a ;
>>Beacause it says "duplicate name for target" for a.cpp. It tries to
>>create one a.obj with <dependency>a and another without it. Is there a
>>way around?
>I'm pretty much a novice, so this could be all wrong, but couldn't you
>create a.o (the object file) for a.cpp first, and then put that
>as the dependency (maybe <dependency>a_obj )?
You are absolutely right. But that would require to declare each obj by
hand and one of the features of bjam that I like is the sort Jamfiles
;-). So, while this is completely valid and working workaround, I'd be
interested to know if the 'dependency' feature is included intentionally
in the duplicity calculation. According to my understanding it does not
modify the build command, does it?

What I would really like would be to replace the dependency
specification by something else that would state that 'unit-test b' is
unit test for b.cpp, so it needs to be run anytime b.obj is linked to
something. Something like

unit-test a.cpp : a-test.cpp ;
unit-test b.cpp : b-test.cpp a.cpp ;
unit-test c.cpp : c-test.cpp b.cpp a.cpp ;

which would equal to

unit-test a : a.cpp a-test.cpp ;
unit-test b : b.cpp b-test.cpp a.cpp : <dependency>a ;
unit-test c : c.cpp c-test.cpp b.cpp a.cpp : <dependency>a <dependency>b ;

Isn't this somewhat similar to usage requirements? And if it could be
specified for headers too, that'd be great:

unit-test u.h : u-test.cpp ;


Faculty of Mathematics and Physics, Charles University, Prague, Czech Republic

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