If I have cmake build system that generate makefiles and project files, should I commit and push the makefiles to git repo? What are advantages and disadvantages of this?
If not, then after each pull and before build we need to generate all again using cmake?
Also, if I generated makefiles and build target, and then changed source file and then generated makefiles again (which is unnecessary), will cmake know what is already up to date? Or it will build all from scratch again?
In a CMake-based project, running cmake
is not just a normal and expected part of the build process, but a required one. It prepares build supports and data (project file / makefile / etc.) that are customized to the build machine. Committing those generated artifacts helps no one, and it needlessly opens an avenue for confusion and user error (using the versions from the repository instead of generating new).
There is a school of thought that argues that nothing that can be (re)built automatically should be committed. I do not go so far myself, but certainly there's no point in committing anything that must be (re)built.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With