I'm considering reimplementing our build system (currently based on GNU Make
) in CMake
.
Disclaimer: this is more of a theoretical and "best practices" question. I don't know CMake
in-depth. Also, please feel free to migrate the question to programmers if it's more on-topic there.
As far as I understand, the standard workflow for CMake
is
cmake .
make
I suspect there may be problems of de-synchronization of CMake
files and Makefiles.
So, during usual development process you're supposed to run make
to avoid unnecessary rebuilds of CMakeCache
and Makefiles
and generally make the process more straight-forward. But then, if you add, say, a new source file to CMakeLists
and run make
, it'll be using old CMakeCache
and Makefiles
and will not regenerate them automatically. I think it may cause major problems when used at scale, since in case something is not building as it should, you'll have to try to perform make clean
, then, if it doesn't help, you'll need to remove CMakeCache
and regenerate everything (manually!).
If I'm not right about something of the above, please correct me.
I'd like to just do
awesome-cmake
and have it update everything what needs updating and build the project.
So, the question: is there a way to make "atomic build" with CMake so that it tracks all the required information and abstracts away the usage of make
?