CCache with Visual Studio Generator causing files to be compiled always

Hello All,

I picked up compiler caching subject again for C++ on windows using Visual Studio Generator. I was reading ProfessionalCMake_18th_Edition.pdf and this book has complete section compiler cache wehere in compile caching using ccache is being exained greatly. I must say its great book. Thanks @craig.scott for the book.

I followed book and it seems caching is working (not 100% but greatly) but one thing I noticed, even though I have compiled my library and without any change in source file, if I compile same library again it compiles the all sources of that library. This is very unusual. I tried to figure out what is happening but could not understand the same.

So every time I build it always builds all source file which seems not right behaviour.

I am attaching the sample reproducible project . Would appreciate help on any direction here.
WorkspaceCCache.zip (6.3 KB)

I’m not familiar with VS enough to debug it, but if it happens with the Ninja generator, you can use ninja -d explain to see why ninja is running a rule. msbuild may provide this information as well. That’s where I’d start.