I’m a moderately advanced GNU Make user new to CMake, and I have some questions I’d expect to find in the FAQ to help me better contextualize what CMake can and can’t do, and what it is and isn’t good at, and understanding what problems it solves. I will try to present these as clearly as possible.
Disclaimer: At this point, I am primarily interested in understanding CMake from the perspective of understanding and improving one particular project (“Blender”) already using CMake.
-
I understand that CMake generally just generates makefiles, build files or project files for whatever environment is being targeted. Can/will it invoke these build tools as well? Or is that typically always done by the user?
-
I understand that many CMake options (like
-DVERBOSE=On
) are given on the command line, rather than in the project’s configuration. Do these generate stateful differences in the output makefiles? Or simply invoke the build tools such that the generated tooling, that is already sensitive to these running states? Are different variations of these options generally put in distinct out-of-tree build directories so they don’t overwrite each other? Can a user provide default values for some of these command line options in an optional config file that can be.gitignore
d? How is that done? -
I know CMake stays aware of it’s version and compatibility. Does it maintain awareness of versions of installed tools that it generates files for? Does it vary the output based on installed versions?
-
POSIX and GNU Make both have many well-documented shortcomings. (i.e. ignoring file content changes and relying on time stamps, ease of corrupting a build state by interrupting a build, difficulties in propagating dependencies properly through recursive makefiles, language readability and parseability. etc…) Some of these can be mitigated by “clever techniques”/hacks to work around some of these. Does CMake optionally, or by default try to implement any of these strategies? Does CMake have any role in avoiding these pitfalls?
Thank you for your patience with my likely-naive questions. If any of these questions is particularly project-specific, please let me know so I can ask within the project.
Thank you in advance for your insights,
Loren Osborn