Not Configuring When Cleaning Targets

SCons User Guide 0.98.0
Prev | Chapter 21. Multi-Platform Configuration (Autoconf Functionality) | Next

# 21.7. Not Configuring When Cleaning Targets

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... ok
        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

Prev | Home | Next
Adding Your Own Custom Checks | Up | Caching Built Files