[Scons-users] Overriding Object to force global dependency

Greg Ward greg at gerg.ca
Thu Jun 28 14:27:42 EDT 2012


On 28 June 2012, Kyle J Strand said:

> The env.AddMethod() method isn't actually what you want; try this:

>

> env['BUILDERS']['Object'] = Object

>

> I tested this by printing env.Dump('BUILDERS') before and after this

> command, cloning the environment to env2, and printing

> env2.Dump('BUILDERS'), and looks like it works exactly as intended.


Alas, that doesn't work. I don't actually need to override the Object
builder, because there's nothing wrong with how it calls g++. What I
need to override is the env.Object() method that tells SCons about
foo.cpp and foo.o in the first place.

That is: I need to sneak an additional dependency into the graph
(early), not interfere with the build itself (late).

So, my original question stands: how do I artificially inject an
additional dependency into the graph for every single *.o file? The
dependency is known early, so there's no reason to try to inject it
late, at build time.

Greg


More information about the Scons-users mailing list