I noticed that when I change the value ON\OFF of some option variables, re-running cmake -S -B [...] without the --fresh flag does not apply the changes to those option variables.
In CMake project mode, a boolean cache variable is created with the option value. In CMake script mode, a boolean variable is set with the option value.
So, being in project mode, generates a cache variable. Does this mean that every time I want to update them, even though changing them in CMakeLists.txt, I need to run a --fresh generation?
This is the default for the option. If the cache variable already exists, it is not updated. CMake has no mechanism to know “user set it to OFF” versus “the old default was OFF” when seeing this code.
I get it. That’s why switching from OFF to ON was not producing any effect, and needed --fresh to regenerate the cache.
Is there a way of disabling caching? I guess it involves set(). But what if the user does pass a desired value though the command line. Does it avoid set() to override the value?
EDIT: to phrase the question better: what’s your best recommendation in such situations (default vs. user-defined)?