我想将编译器定义设置为-DBLUB以及-DFOO = 1.
目前我只有:
env.Append("CPPDEFINES",["BLUB","VALUE2"])
我现在想通过“FOO”包含第三个定义:1然后使用CPPDEFINES作为字典,以便稍后我可以很容易地测试
env["CPPDEFINES"].get("FOO") == 1
最佳答案
如果需要为任何单个定义指定值,则CPPDEFINES必须是字典.
原文链接:https://www.f2er.com/python/439190.htmlIf $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.
对于你的例子,我建议:
env.Append(CPPDEFINES = { 'BLUB': None,'VALUE2': None,'Foo': 1 })
要么
env.Append(CPPDEFINES = { 'BLUB': None,'VALUE2': None })
...and sometime later...
env.Append(CPPDEFINES = { 'Foo': 1 })