This is what cmake-gui also does to avoid CMake crashing on repeated attempts to configure it. Fixes #16423.