[CMake] losing CMakeCache.txt after changing the compiler...

Hendrik Sattler post at hendrik-sattler.de
Sat Jun 2 10:57:36 EDT 2018


Hi,

I also found that e.g. Qt Creator throws away the cache too eagerly, e.g. when  changing the deployment target IP address on the kit.

This led me to finding a solution for keeping command line definitions elsewhere because relying on the cache will hurt you bad sometimes.

Maybe more project-foreign people need to test cmake-enabled IDEs and ask for better behavior.

Otoh, cmake also should not rely that hard on its cache. When I upgrade the Qt installation and delete the old one, cmake fails hard where only a cmake expert can recover easily from. Why can't it check that cache file locations still exist when it runs? 

When I upgrade gcc on linux, cmake doesn't notice at all, although almost all derived values are wrong at that point.

HS


Am 2. Juni 2018 11:43:02 MESZ schrieb "René J.V. Bertin" <rjvbertin at gmail.com>:
>Hi,
>
>This happened once too often for me: I apply successive tweaks to a
>CMakeCache file, reinvoke make (or ninja) and then at some point lose
>everything because I forgot that changing the compiler is a "lethal"
>operation.
>
>Why does cmake have to throw away the entire cache file when something
>changes in the compiler path? That seems like a cheap way to implement
>a "let's keep track of which cached settings depend on the choice of
>compiler". At the least it wouldn't be much less cheap to rename
>CMakeCache.txt to CMakeCache.bak instead of deleting it.
>
>And FWIW, this is also a situation in which storing the exact CMake
>invocation in a comment at the top of the cache file could be useful...
>
>R.


More information about the CMake mailing list