It is possible to override or add construction variables when calling a builder method by passing additional keyword arguments. These overridden or added variables will only be in effect when building the target, so they will not affect other parts of the build. For example, if you want to add additional libraries for just one program:
env.Program('hello', 'hello.c', LIBS=['gl', 'glut'])
or generate a shared library with a non-standard suffix:
env.SharedLibrary('word', 'word.cpp', SHLIBSUFFIX='.ocx', LIBSUFFIXES=['.ocx'])
It is also possible to use the parse_flags
keyword argument in an
override:
This example adds 'include' to $CPPPATH
,
'EBUG' to $CPPDEFINES
, and 'm' to $LIBS
.
env = Program('hello', 'hello.c', parse_flags = '-Iinclude -DEBUG -lm')
Within the call to the builder action the environment is not cloned, instead an OverrideEnvironment() is created which is more light weight than a whole Environment()