SCons User Guide 0.93 | ||
---|---|---|
<<< Previous | Construction Environments | Next >>> |
SCons provides various methods that support modifying existing values in a construction environment.
You can replace existing construction variable values using the Replace method:
env = Environment(CCFLAGS = '-DDEFINE1') env.Program('foo.c') env.Replace(CCFLAGS = '-DDEFINE2') env.Program('bar.c') |
The replaced value completely overwrites
% scons -Q
cc -DDEFINE2 -c -o bar.o bar.c
cc -o bar bar.o
cc -DDEFINE1 -c -o foo.o foo.c
cc -o foo foo.o
You can append a value to an existing construction variable using the Append method:
env = Environment(CCFLAGS = '-DMY_VALUE') env.Append(CCFLAGS = ' -DLAST') env.Program('foo.c') |
% scons -Q
cc -DMY_VALUE -DLAST -c -o foo.o foo.c
cc -o foo foo.o
You can append a value to the beginning an existing construction variable using the Prepend method:
env = Environment(CCFLAGS = '-DMY_VALUE') env.Prepend(CCFLAGS = '-DFIRST ') env.Program('foo.c') |
% scons -Q
cc -DFIRST -DMY_VALUE -c -o foo.o foo.c
cc -o foo foo.o
<<< Previous | Home | Next >>> |
Fetching Values From a Construction Environment | Up | Default Targets |