Boost logo

Boost-Build :

Subject: Re: [Boost-build] Compiling dozens of files called main.cpp
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2010-01-19 02:52:56


Johan Nilsson wrote:
> Boris Schaeling wrote:
>> I'm trying to compile dozens of files in countless subdirectories. I
>> came up with this simple Jamroot file as all files are called
>> main.cpp: import testing ;
>> compile [ glob-tree main.cpp ] ;
>
> I think the problem is that the test target name is derived from the
> first source file.
>
> Note that compile accepts a third, optional, argument that accepts a
> specific target name. Could you try an explicit loop and uniquely
> name the targets instead?
>
> [caveat: haven't actually tried this]
>
> import testing ;
> import numbers ;
>
> local mains = [ glob-tree main.cpp ] ;
> local n = 1 ;
>
> for local m in $(mains)
> {
> compile $(m) : : main.test$(n) ;
> n = [ numbers.increment $(n) ] ;
> }

Oh, and you won't be able to build multiple variants concurrently with this
solution.

/ Johan


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