Boost logo

Boost-Build :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2006-03-25 14:54:37


Vladimir Prus wrote:
> On Saturday 18 March 2006 20:54, Rene Rivera wrote:
>> Noel Belcourt wrote:
>>> Hi,
>>>
>>> We've got a couple of source directories that we depend on but cannot
>>> otherwise modify. Our problem is that there are ~500 source files in
>>> this directory and I want to glob all the files but one. Is there some
>>> notation to allow me to exclude one or more files from a glob? I'd
>>> really hate to have to enumerate each source file in the Jamfile.
>> Assuming BBv2 for this example... Something like this should work:
>>
>> import set ;
>> import path ;
>>
>> local files =
>> [ set.difference
>> [ path.glob /path/ : *.cpp ] : [ path.glob /path/ : special.cpp ]
>> ] ;
>
> If this happen in Jamfile, things can be even simpler:
>
> import set ;
>
> local files =
> [ set.difference
> [ glob /path/*.cpp ] : /path/special.cpp ] ;
>
> I.e.
> - using 'glob' not 'path.glob' can be more convenient
> - if there's one file to exclude, no need to glob for it, just name it

Just tried that... It doesn't work in a platform independent manner as
you have to match the "/" vs "\" depending on the platform. But this works:

exe foo :
   [ set.difference
     [ glob /path/*.cpp ] : [ glob /path/special.cpp ]
     ] ;

As the glob will normalize both to the same style of path separators.
And it's not like there's a worry about doing all that much extra work
on the multiple globs, as directory scanning is cached within bjam.

--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

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