Finally understanding CMake easy!!!

Finally understanding CMake easy!!!

I’ve always used CMake and QMake in a pretty practical way: just enough configuration to get my projects up and running — and moved on.

I never had major issues… but to be honest, I never really stopped to understand what was happening under the hood either.

That’s where Minimal CMake by Tom Hulton-Harrop really surprised me!

With a hands-on, straight-to-the-point approach packed with real examples, I finally understood how CMake actually works — and more importantly, how to use it way more effectively in my day-to-day projects. 📈

And honestly?

I’m amazed by how far you can actually go with CMake!

I really should have invested more time learning it properly much earlier.


🛠️ What the book covers

Minimal CMake is organized into three well-structured parts:

1. Getting started:

The first chapters walk you through setting up your environment (Windows, Linux, and macOS) and introduce CMake from the terminal. You build a simple project and step-by-step learn how to configure the CMakeLists.txt.

2. Scaling up your project:

Once you’re comfortable with the basics, the book dives into:

  • Managing dependencies using FetchContent and ExternalProject_Add.

  • Creating your own libraries, adding installation support, and even super builds to organize complex projects.

  • Using modern practices like CMake Presets to streamline the whole setup.

3. Wrapping things up:

In the final stretch, it covers:

  • Setting up automated tests with CTest.

  • Packaging your project for different platforms using CPack.

  • Leveraging tools like CMake Tools inside Visual Studio Code for a smoother workflow.


✨ Some practical examples that really stood out to me

Just to give you a taste of what you can start applying right away:

➡️ A minimal CMakeLists.txt

This is a very basic for a C Hello World project.


➡️ Bringing in dependencies with FetchContent

Just a few lines and your external libraries are automatically fetched and integrated — no manual cloning or configuring needed.


➡️ Setting up tests easily with CTest

This CMake code enables testing functionality and defines a test named 'test_hello' that runs the 'hello-cmake' executable.


➡️ Packaging your project with CPack

Want a ZIP file, a Windows installer (NSIS), a macOS app bundle, or a Linux DEB package?

CPack has you covered — from a single project setup!


🎯 My experience with the book

What I loved the most is that the book truly delivers what it promises: it focuses only on what matters.

No unnecessary theory, no overcomplication — and lots of “Aha! So that’s how it works!” moments along the way.

Also:

  • The examples are practical and build progressively.

  • Every chapter explains why certain decisions are made, not just how.

  • The writing is light and easy to follow.


📦 Who I would recommend this book to

If you’re a C or C++ developer — beginner or experienced — and you want to:

  • Master the tool that’s now the gold standard for cross-platform builds;

  • Learn best practices in a practical, no-nonsense way;

  • Build better-structured, easier-to-share projects;

This book is an excellent investment!

Interested in diving deeper?

You can find Minimal CMake on Amazon - Minimal CMake — highly recommend checking it out!

Thales Faggiano

Decision & Technology Strategist | Helping People at Business, Product and Technology Teams Make Better Decisions | Neurodiverse

3mo
Igor R Faggiano, PQO, MS, MCPS

Sr. Tech Development Engineer (.NET/C#/ASM/C/C++); Asset Manager/Forex Trader; Superior em Ciência de dados (Estatística e Finanças Quantitativas)

3mo
Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics