froglogic / All / 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.



You should post some benchmarks to show how much this tool helps and how it compares to ccache.


It doesn’t support multiple source files in a single compiler invocation, which means it’s useless when compiling Qt 🙁

    Recent clcache versions actually *do* support invoking the compiler with multiple source files. The only case where this is not supported is when you also pass /Tc or /Tp on the commandline.

    Did you not get this working with “qmake?” I think Frerich Raabe might have missed your point, that qmake Makefiles format the “cl.exe” calls in a certain way. From my point of view, it would be good to know whether clcache works with Qt’s build tool, qmake.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copy link
Powered by Social Snap