I'd like to set the compiler defines to -DBLUB as well as -DFOO=1.
Currently I only have:
env.Append("CPPDEFINES", ["BLUB", "VALUE2"])
I now would like to include a third define via "FOO" : 1 and thus use CPPDEFINES as a dictionary so I can later on test quite easy
env["CPPDEFINES"].get("FOO") == 1
or so. Everything I attempted leads to syntax errors or strange errors. Could one explain the strange ways to do this in python to me?
If you need to specify a value for any single define, CPPDEFINES
must be a dictionary.
From the scons User Manual:
If $CPPDEFINES is a dictionary, the values of the $CPPDEFPREFIX and $CPPDEFSUFFIX construction variables will be appended to the beginning and end of each item from the dictionary. The key of each dictionary item is a name being defined to the dictionary item's corresponding value; if the value is None, then the name is defined without an explicit value.
For your example, I suggest:
env.Append(CPPDEFINES = { 'BLUB': None, 'VALUE2': None, 'Foo': 1 })
or
env.Append(CPPDEFINES = { 'BLUB': None, 'VALUE2': None })
...and sometime later...
env.Append(CPPDEFINES = { 'Foo': 1 })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With