[Scons-users] CPPDEFINES Unexpected Behavior

Evan Driscoll driscoll at cs.wisc.edu
Thu Apr 11 15:50:12 EDT 2013


On 04/11/2013 02:35 PM, Managan, Rob wrote:

> Admittedly a contrived example but it seems that if you add anything to

> CPPDEFINES it gets converted to a list and something in the subset goes

> wrong.


Ah, *that* explains why I hadn't run into a problem... I don't use
Append or AppendUnique to set or modify CPPDEFINES, I don't use
CPPDEFINES as a list. Instead, when I want to add to or modify
CPPDEFINES, I just say something like
env['CPPDEFINES']['SOMETHING']='value'..

Also, just to be absolutely clear, the problem is that apparently dicts
and a list of pairs are treated differently. You can see this with the
following single-line SConstruct (put it in a directory with a foo.cpp):

Object("foo.cpp", CPPDEFINES=[("SOMETHING", None)])

This will cause
% scons -nQ
g++ -o foo.o -c -DSOMETHING=None foo.cpp


This also is surprising to me, though as I said it's not something I've
run into. And it makes clear that the problem (assuming you agree that
it is one) is when CPPDEFINES is being converted into a command line
argument and doesn't *really* have anything to do with Append() or
AppendUnique() per se.

Evan




More information about the Scons-users mailing list