Enjoyable and\or fun way to explain cmake

As a pilot project (which was delayed by an incredible amount, seeing as it's starting 8 weeks after it was meant to), my school grouped together a few kids (high school, they know basic OOP and work in Java) and we teach them a bit about C and working in C.

We use CLion, which in turn uses CMake to organize header files. Naturally, the more inquisitive students asked what cmake does. (Like a plant, because it is in the curriculum anyway).

So, I was trying to think of ways to explain what cmake does, in an analogy. Because CMake can get exponentially more complicated as one adds modules, I am focusing on analogies that simplify this, and hopefully present in an enjoyable way (such as a demonstration or student participation).

The idea is to explain how CMake can be useful for arranging header files.

So my question is what analogies can I use, which preferably include student participation?

• the best advice you can get is: read the manual for cmake, then use google to search for examples, etc. Dec 19, 2017 at 15:57
• What does “organize header files” mean? Dec 19, 2017 at 21:19
• I am new to cmake, I just looked it up. It seems to be to me a tool for making makefiles. So a meta make. Meta is my favourite Greek word. It has two meanings, the first is beyond, the second has no equivalent in English. It sort of doubles the following word, e.g. meta thinking, is thinking about thinking; a meta language is a language used to describe languages; and a meta make, is a make for making a make. Dec 24, 2017 at 23:03

1 Answer

cmake, allows you to define variables, these variables can be filled with strings. These strings can be tools or files. Additonally it allows for conditional compiling, setting version numbers and library injection. I would have a look at: https://cmake.org/cmake-tutorial/

Now on how to explain: Cmake utilizes a script language to make building projects much easier. It has a feature set that does specific things. Like requiring specific versions of files. How to make it "fun" I dont know. But you could split your class in groups that each have to create a header cmake replacement script, with a specific variable name. And a program that does anything they like, but has to use the defines. For example DEBUG Then each group has to create a list of substitutions, and they share the substitutions. While executing the diffrent substitutions, they have to determine why something breaks or works although it shouldnt. This can be used to examplify, how the header operations work, and also how wrong or malicous usage can wreak havoc in their project.