0

I am trying to use ccache with CMake. I have placed symlinks named gcc, g++ and c++ in /usr/local/bin. If I run make, add some change to CMakeLists.txt that does not affect the compiled files (add unused library just to force make build all the targets) and re-run make, everything is recompiled as if there was no ccache. However, if I remove all CMake-generated files and then call cmake; make, everything works fine, and object files are retrieved from cache, even if I change CMakeLists.txt.

Looks like something CMake-generated prevents hitting the cache. I tried searching through verbose output of both make and cmake, but could not find any dependencies that could cause this behaviour.

Dmitry Risenberg
  • 2,321
  • 2
  • 18
  • 22

2 Answers2

0

I suggest that you install ccache 3.0 (released just some days ago) and set CCACHE_LOGFILE to a file. ccache will then print what it's doing to that file and you will probably get a clue about the problem.

Joel Rosdahl
  • 846
  • 9
  • 12
0

When cmake runs, it puts the full paths of the binaries into CMakeCache.txt. This is a speed-optimization so that future configurations are fast (part of the reason autoconf takes so long is that it looks for so many things over & over again). If you want to force cmake to rescan, remove the CMakeCache.txt file or filter out from that file the variables containing the paths to the tools you want it to refresh.

Vitali
  • 3,411
  • 2
  • 24
  • 25