ccache caches even the objects generated from the compiler check in CMAKE. I am using namespaces in ccache (CCACHE_NAMESPACE=whatever), to build with 3 different environment based configs, but there are linking errors on the second build, as the first build uses ASAN, and the second build does the compiler check with ASAN off but uses the old object files that have ASAN enabled because in both cases the NAMESPACE is gone.
Are you re-using the same build directory for each of the three different environments? If so, you must clear the information CMake caches between runs. You can either add the --fresh
option to when you run cmake
, or you could just delete the contents of your build directory completely each time.
Yes, I do already take that into account. I remove the cache.txt and the CMakeFiles directory each subsequent build
I have realized that I was using an out of date version of ccache though, could have been that…
@craig.scott which version of cmake introduced --fresh?
The CMake documentation for the option says --fresh
was added in CMake 3.24.