Boost logo

Boost-Build :

From: McMillan, Scott (scott.mcmillan_at_[hidden])
Date: 2007-01-10 09:02:01

> > generators.register-standard cxxtest.gencxx-file : CXXTEST_H : CPP ;
> ........
> > exe FooTS_runner : FooTS.cpp FooTS_runner.cxh : /* other
requirements */
> ........
> >
> > Notice that I had to add the "_runner" to the cxh file so that there
> > would not be two FooTS.o files (one from FooTS.cpp and one from
> > processing FooTS.cxh and compiling the result).
> >
> > It is unsatisfying to rename the header file this way
> Try:
> generators.register-standard cxxtest.gencxx-file : CXXTEST_H :
CPP(%_runner) ;
> that should append the _runner suffix to the generated CPP

That is the solution for Item 1 below. Thanks.

> > 1) If I wanted to continue with the .cxh approach, is writing a
> > generator the way to process FooTS.cxh into FooTS_runner.cpp. If so
> > could someone please help me as it is neither clear what method to
> > override (generate-targets?) nor how to do it to accomplish this
> You could have overriden generate-targets to append _runner to the
> of the output target.

I tried to do this but I just don't understand the contents of the
various arguments and what needs to be returned to be able to write the
appropriate method. It would be helpful to my education to see an
example doing it this way (even though I prefer the solution above).

> > 2) Ultimately I would like to get back to something closer I have
> > our current Imakefile system which was to define a new rule that
> > FooTS as the argument (I would settle for a rule that had to take
> > FooTS.h and FooTS.cpp as arguments), generates FooTS_runner.cpp from
> > FooTS.h and compiled and linked FooTS.cpp and FooTS_runner.cpp into
> > executable called FooTS_runner.
> Would:
> exe FooTS_runner : FooTS.cpp FooTS.h ;
> work, as soon as _runner is automatically appended? Or you want
> different?

I am not sure what you are asking. I don't think that I want exactly
the line above in my Jamfiles because that would imply that there would
be two different behaviours in my code for the exe rule. Note that I do
build applications with the exe rule that does not require this
generation of *_runner.cpp files from header files, so I am wondering
how would a developer distinguish when a cxxtest application is being
built and when a normal application needs to be built. Please clarify
if I am off-base here.

I think what I would prefer is a new rule that allows me to write
something like:

     cxxtest_exe FooTS_runner : FooTS.cpp FooTS.h ;

and have it recognize that it is FooTS.h that needs to be used to
generate the FooTS_runner.cpp file.

Just so you know where we are coming from now is that the Imake template
that we use (we actually use two to distinguish between unit and
performance test targets) only takes the test suite name, i.e. FooTS,
and assumes that FooTS.cpp and FooTS.h exist and generate all the
necessary make targets from that.


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