Boost logo

Boost-Build :

Subject: Re: [Boost-build] Using a generator directly in the sources?
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-08-27 01:15:59


On Friday 27 August 2010 02:25:32 Boris Schaeling wrote:

> On Fri, 27 Aug 2010 00:14:05 +0200, Steven Watanabe <watanabesj_at_[hidden]>
> wrote:
>
> > [...]
> >> If there is no file my.generator bjam complains even if the file
> >> extension .generator is registered? Just want to make sure I don't give
> >> a wrong advice to a developer who asked me. :-)
> >
> > I'm not sure what you would expect this to do.
>
> He wanted the generator to return filenames based on the basename (like
> my.cpp and my.h for my.generator). But I'll talk to him tomorrow again to
> better understand the problem.

Assuming you have target type FOO, and generator for type FOO that accepts no
sources, it's possible to write:

        foo my ;

and I *think* it should produce my.cpp and my.h if the generator is so defined.
And of course, the 'my' target can be used from other targets. Note that "FOO"
is not required to be a "real" type that some files have. Say, tools/boostbook.jam
has a type BOOSTBOOK_MAIN and there's generator for that type -- but it never
produces a target with such type. It's OK, the type is only used to "abstractly"
specify what we need.

Thanks,

--
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build: 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