Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-10-17 14:56:11

On Tuesday 17 October 2006 22:28, Emil Dotchevski wrote:
> > Emil Dotchevski wrote:
> >> Hello,
> >> <snipped>
> >> The end result I need is this: when a header file of the said library is
> >> included in a cpp from another location, the library header file gets
> >> the name of the including cpp.
> >> <snipped>
> >
> > I'm assuming that you want the define to change for each file compiled
> > in the library target?
> I am a bit confused by this reply.
> The library itself, or its source files, do not need any defines. What I
> need is the library's usage requirements to cause a <define> to appear in
> all client targets, such that each cpp file in a client target gets a
> "-D__BASE_FILE__=<n>" passed to the compiler, where <n> is the (complete)
> name of the cpp file (from the client target, not the library) being
> compiled.
> Clearly, boost-build has the cpp file when it launches the compiler, so it
> seems to me that at least there should be a way to modify the msvc support
> in boost-build to always pass a -D on the command line to specify the cpp
> file being compiled. Even if the solution is hard-coded in the msvc
> support, it would be of great help to me.

Hardcoded solution is surely possible. You'd need to derive new generator
class from the C-compiling-generator, or how it's called (from builtin.jam).
Then, override the 'generated-targets' rule to add your define to properties
and call the base version. Then, modify msvc.jam to use that new generator
class for compile generators.

A bit vague, I know ;-)

- Volodya

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