Boost logo

Boost-Build :

Subject: Re: [Boost-build] Generating multiple CPP/H targets from a single source
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2010-08-05 04:28:02


Fabien Chêne wrote:

> I encouter the same bug, from a similar generator, and it fails
> sometimes, particularly when using parallelism.
>
> Here is a reduced jamfile:
>
> exe test : test.idl ;
>
> it will produce:
> test.gen.h
> test.gen.hh
> test.gen.cxx
> test.genSK.cxx
>
> Dependencies are as follows:
> test.genSK.cxx includes the file test.gen.hh
> test.gen.cxx includes the file test.gen.h
> test.gen.h includes the file test.gen.hh
>
> I think that the problem here is that bjam can't know that
> test.gen.cxx will depend on test.gen.h without looking at generated
> files -- and bjam can't look at them when they are not yet generated.
> So, we need a way to teach bjam that there is a dependency.
>
> I've been playing for a while with virtual-target.depends, DEPENDS
> without any luck.
> I've tryed a nightly build and Boost.Build 3.1.18 without success.
>
> About the OP's example, it looks the same
> SourceForCodeGeneratorSupport.cpp depends on
> SourceForCodeGeneratorSupport.h but bjam don't know it when files are
> not yet generated. Right ?

bjam is supposed to rescan a file right after it is generated, so
it should pick this dependency. The relevant code is in make1.c,
afterh the comment that reads:

            /* Target has been updated so rescan it for dependencies. */

You might want to start by adding some debug prints in there to make
sure the .cpp file is actually rescanned, and what headers are found.

- Volodya


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