Migrating a configurable autotools-based build to CMake

Possible? If the values are made the same each time, it should no-op correctly. You can use make -d to have it say why it thinks each thing needs to rerun. If you use the Ninja generator ninja -d explain does it more concisely.

You can instead do something like:

if (NOT current_value STREQUAL previous_value)
  unset(current_value CACHE)
endif ()
set(previous_value "${current_value}" CACHE INTERNAL "")

to instead only remove the cache variable when its value changes. But I doubt that this is the actual problem here. I would instead suspect a generated file that is included at some core is written manually using file(WRITE) instead of using something like configure_file.