SCons User Guide 0.92 | ||
---|---|---|
<<< 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
gcc -DDEFINE2 -c bar.c -o bar.o
gcc -o bar bar.o
gcc -DDEFINE2 -c foo.c -o foo.o
gcc -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
gcc -DMY_VALUE -DLAST -c foo.c -o foo.o
gcc -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
gcc -DFIRST -DMY_VALUE -c foo.c -o foo.o
gcc -o foo foo.o
<<< Previous | Home | Next >>> |
Fetching Values From a Construction Environment | Up | Building and Linking with Libraries |