[Scons-users] Extending a parameter list

Dirk Bächle tshortik at gmx.de
Tue Oct 21 08:27:35 EDT 2014


Hi,

On 21.10.2014 14:09, Barnaby Jones wrote:
> I'm using Python 2.7.8 with scons 2.3.5 linux/arch
>
> Is it possible to extend a compiler parameter list? Until recently i 
> thought this would work:
>
> cc_flagsShared = Split("""-DHAVE_CONFIG_H
>                     -std=c11
>                     -Werror""")
>
> and append or extend it with
>
> cc_flagsStatic = cc_flagsShared.append('-DMAKE_STATIC')
> cc_flagsStatic = cc_flagsShared.extend('-DMAKE_STATIC')
>
>
> but in this case cc_flagsStatic is always empty:
>
yes, it's well possible...but you have to assign your additional 
definitions to the correct Environment variables:

   env = Environment()
   cc_flagsShared = Split("""-DHAVE_CONFIG_H
                     -std=c11
                     -Werror""")
   env['CFLAGS'] = cc_flagsShared

, then extend with:

   env.Append(CFLAGS=['-DMAKE_STATIC'])

Note: For defines it's always better to use the CPPDEFINES variable, 
because this will give you cross-platform compatibility for free. 
Checkout the User guide and read some more on how to assign and extend 
Environment variables!

Best regards,

Dirk



More information about the Scons-users mailing list