Using multi-platform configuration
as described in the previous sections
will run the configuration commands
even when invoking
scons -c
to clean targets:
% scons -Q -c
Checking for MyLibrary... yes
Removed foo.o
Removed foo
Although running the platform checks
when removing targets doesn't hurt anything,
it's usually unnecessary.
You can avoid this by using the
GetOption
method to
check whether the -c
(clean)
option has been invoked on the command line:
env = Environment() if not env.GetOption('clean'): conf = Configure(env, custom_tests={'CheckMyLibrary': CheckMyLibrary}) if not conf.CheckMyLibrary(): print('MyLibrary is not installed!') Exit(1) env = conf.Finish()
% scons -Q -c
Removed foo.o
Removed foo