How to generate a specific CPPDEFINE such as -DOEM="FOO BAR" using Scons

Posted by Vineet on Stack Overflow See other posts from Stack Overflow or by Vineet
Published on 2010-04-27T20:59:12Z Indexed on 2010/04/27 23:23 UTC
Read the original article Hit count: 184

Filed under:

My intention is to end up with a compiler command line including -DOEM="FOO BAR"

I have the following in my SConstruct file:

opts = Options( 'overrides.py', ARGUMENTS )
opts.Add( 'OEM_NAME', 'Any string can be used here', 'UNDEFINED' )
.
.
.
if (env.Dictionary('OEM_NAME') != 'UNDEFINED'):  
    OEM_DEFINE = 'OEM=' + str(env.Dictionary('OEM_NAME'))
    env.Append( CPPDEFINES=[ OEM_DEFINE ] )

Then I put the following in the "overrides.py" file:

OEM_NAME = "FOO BAR"

I seem to end up with "-DOEM=FOO BAR" in the command line that gets generated. Can someone point me in the right direction? Thanks.

© Stack Overflow or respective owner

Related posts about scons