Settings

Theme

Zero to CMake: A beginner's guide to why CMake works

buchanan.one

2 points by boscillator a year ago · 4 comments

Reader

gjvc a year ago

this article misses a crucial conceptual point of using a higher-level build tool / meta-build tool with this line

    cd build && make
by not using instead

    cmake --build build/
and then use all the other options available to the cmake --build command. Think of CMake as your multi-platform build tool, not just a "makefile generator".
  • boscillatorOP a year ago

    Yah, absolutely. In the real world that is absolutely the way to go (and I suspect will be managed by your IDE in a lot of cases), but I wanted to show what it means for CMake to be a generator, and Makefiles are the easiest build system to show that with.

    • gjvc a year ago

      yes but nobody cares that it is, because those generated makefiles or ninja files are not user-serviceable, so it might be worth adding a remark to the article (which was very thorough I should emphasise, just that it was missing the reasoning here)

      also you might want to consider using

          make --directory build/
      
      which of course leaves the user in the original place, and as such is a bit more ergonomic

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection