How to use ccache selectively?

Anonymous picture Anonymous · Apr 22, 2010 · Viewed 17.4k times · Source

I have to compile multiple versions of an app written in C++ and I think to use ccache for speeding up the process.

ccache howtos have examples which suggest to create symlinks named gcc, g++ etc and make sure they appear in PATH before the original gcc binaries, so ccache is used instead.

So far so good, but I'd like to use ccache only when compiling this particular app, not always.

Of course, I can write a shell script that will try to create these symlinks every time I want to compile the app and will delete them when the app is compiled. But this looks like filesystem abuse to me.

Are there better ways to use ccache selectively, not always?

For compilation of a single source code file, I could just manually call ccache instead of gcc and be done, but I have to deal with a complex app that uses an automated build system for multiple source code files.

Answer

mimoralea picture mimoralea · Sep 25, 2013

To bypass ccache just:

export CCACHE_DISABLE=1

For more info:

man ccache

...

        If you set the environment variable CCACHE_DISABLE then ccache will just call the real
       compiler, bypassing the cache completely.

...