Our system supports being built with three different toolchains (gcc, icc, diab). I am not sure if using ccache is safe in this case. My concern is the following: if I build with gcc, and then rebuild with diab, will I get a ccache hit in the case the files and their dependencies are the same ?
I do not want a hit in this case, since I want the files to be recompiled with diab.
Getting ccache to work with CMake is not overly complicated, but the way to do it is not always obvious. This is especially true with Xcode builds. This article demonstrates how to set up a CMake project to use ccache with Unix Makefiles, Ninja or Xcode generators, with Xcode receiving special attention.
Manual cleanup You can run ccache -c/--cleanup to force cleanup of the whole cache, i.e. all of the sixteen subdirectories. This will recalculate the statistics counters and make sure that the configuration options max_size and max_files are not exceeded.
Ccache is a compiler cache. It speeds up recompilation by caching the result of previous compilations and detecting when the same compilation is being done again. Ccache has been carefully written to always produce exactly the same compiler output that you would get without the cache.
To install ccache with Homebrew, run brew install ccache . With MacPorts, run port install ccache . You can also download and install yourself, using the instructions in the repository. Make sure ccache can be found in your $PATH .
You will not get a ccache hit between different compilers. The compiler is hashed. Additionally, you can change the environment variable CCACHE_COMPILERCHECK to check the compiler in a different way. As found in the ccache manual:
For both modes, the following information is included in the hash:
the extension used by the compiler for a file with preprocessor output (normally .i for C code and .ii for C++ code)
the compiler’s size and modification time (or other compiler-specific information specified by CCACHE_COMPILERCHECK)
the name of the compiler
the current directory (if CCACHE_HASHDIR is set)
contents of files specified by CCACHE_EXTRAFILES (if any)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With