Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2006-02-20 12:15:05


Vladimir Prus wrote:
>On Monday 20 February 2006 00:02, Reece Dunn wrote:
> > In a previous version of BBv2, it was possible to have targets like:
> >
> > lib Foo.Bar : foo.cpp ;
> > lib Foo.Bar2 : bar.cpp ;
> >
> > but with the latest sources, I get a duplicate name of actual target
> > Foo.dll error.
> >
> > NOTE: This will impact support for C#/.NET toolsets where it is common
>to
> > have DLLs named a.b.dll
>
>Oh, there was a change that ignores all suffixes from main target name when
>determining the name of the files. This was originally done so that you can
>do:
>
> obj a.obj : a.cpp ;
> xml a.xml : a.whatever ;
>
>withouing causing class between main target names.

Sure.

>I think one solution is a
><name> feature that specifies the basename of the created file, so you'd
>write:
>
> lib Foo.Bar : foo.cpp : <name>foo.bar ;
> lib Foo.Bar2 : bar.cpp : <name>foo.bar2 ;
>
>What do you think?

A little verbose (the It Just Works principle).

>Another solution is to require <name> in the previous case:
>
> obj a.obj : a.cpp : <name>a ;
> xml a.xml : a.whatever : <name>a ;
>
>and don't automatically strip suffix from main target name, but frankly,
>I'm
>undecided which approach is best. Any comments?

Again, this is verbose. NOTE: I haven't checked, but:

   lib Foo.Bar.dll : foo.cpp ;
   lib Foo.Bar2.dll : bar.cpp ;

should work.

Couldn't you do the following (pseudo-code):

   if $(name:ext) == $(target-name)
   {
      name = $(name:S=) ;
   }

where name is the name of the target and target-name is lib, obj, xml, etc.
That way, it will only strip the extension if you have something like:

   obj foo.obj : foo.cpp ;

NOTE: some special logic will be needed for the lib target as you can have:

   lib Foo.Bar.lib : foo.cpp ;
   lib Foo.Bar2.dll : bar.cpp ;

That would mean that my initial example will work without change and the new
suffix-stripping logic will work as required. IMHO, that would be the best
solution (even though it requires more logic)!

- Reece


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