24.5. Populating a Shared Cache With Already-Built Files

Sometimes, you may have one or more derived files already built in your local build tree that you wish to make available to other people doing builds. For example, you may find it more effective to perform integration builds with the cache disabled (per the previous section) and only populate the shared cache directory with the built files after the integration build has completed successfully. This way, the cache will only get filled up with derived files that are part of a complete, successful build not with files that might be later overwritten while you debug integration problems.

In this case, you can use the the --cache-force option to tell SCons to put all derived files in the cache, even if the files already exist in your local tree from having been built by a previous invocation:


      % scons -Q --cache-disable
      cc -o hello.o -c hello.c
      cc -o hello hello.o
      % scons -Q -c
      Removed hello.o
      Removed hello
      % scons -Q --cache-disable
      cc -o hello.o -c hello.c
      cc -o hello hello.o
      % scons -Q --cache-force
      scons: `.' is up to date.
      % scons -Q
      scons: `.' is up to date.
    

Notice how the above sample run demonstrates that the --cache-disable option avoids putting the built hello.o and hello files in the cache, but after using the --cache-force option, the files have been put in the cache for the next invocation to retrieve.