Reconfigure with the same command-line?

CMake does not save the command line used. Even if it did, it wouldn’t be reliable. CMake caches information between runs. The effect of the latest run should be thought of as the accumulation of earlier runs with the latest command line.

Some command-line options are not cached because they don’t affect the build, they only affect the current CMake execution in ways that don’t change the generated build project files. The various -W options like -Wno-dev or -Wdeprecated are one example, as are options like --graphviz or --log-level. You can’t know whether the last cmake invocation had such options.

As others have already mentioned, the rebuild_cache build target is one way to at least re-run CMake with the currently cached details. That’s probably the closest to what you’ve asked for. I’m not sure if it is supported by all CMake generators, it isn’t mentioned anywhere in the official documentation (which actually surprises me).

1 Like