ccache for MSVC

ccache for MSVC

I’ve been a happy ccache user for years. It’s a great tool for avoiding unneeded recompilation by reusing previously cached results – thus speeding up builds quite substantially. Unfortunately, it only works for gcc; there is a ccache patch for MSVC around but it never quite worked for me.

Hence, I decided to write a program which works just like ccache except that it can be used with MSVC. It’s a Python script which is meant to be used as a drop-in replacement for the cl.exe program.

The script basically generates a hash sum out of

  • The compilers file size and modification time
  • The complete preprocessed source code
  • The command line

After computing the hash sum, the cache is checked for whether an this hash sum was used previously. If so, the previously generated object file (and the compiler output) are re-used instead of invoking the actual compiler. This can save quite some time.

The program (as well as a bit more documentation) can be found at

Maybe this is useful to somebody – I’d be happy to get any feedback.