[Scons-users] persistent but local tweaks to a node's environment
Mats Wichmann
mats at wichmann.us
Sun Aug 1 17:32:11 EDT 2021
On 8/1/21 3:04 PM, Gabe Black wrote:
>
>
> On Sun, Aug 1, 2021 at 12:20 PM Bill Deegan <bill at baddogconsulting.com
> <mailto:bill at baddogconsulting.com>> wrote:
>
> So at the time you call StaticObject(), for example, do you know
> what flags are needed for that source?
>
>
> No, I know what *extra* flags are needed for that source, not what those
> flags will be added to. For instance I know I need to disable a warning
> because of an unavoidable local false positive, but not to enable debug
> information, or turn up optimizations.
I'm probably missing something here, but you can query this - the env
works like a dict. So for example, you can do something like:
flags = env.get('CPPDEFINES', [])
env.Program(CPPDEFINES = flags + ['FOO'])
the problem is it's not absolutely guaranteed what datatype you'll get
back when fetching a construction var, because SCons is flexible enough
it will just take whatever you give it (Pythonically), but in some
special cases it might do conversions behind the scenes. In fact,
CPPDEFINES is special-cased if you do Append on it, but not if you
access it directly. I'm not sure this cleverness is entirely helpful.
More information about the Scons-users
mailing list