I like C++ the language, and historically the worst part of C++ has been – building C++ projects. It used to be a chore at best, with build systems ranging from “opaque” (Visual Studio project files) to “arcane” (Makefiles with Configure/Automake.) Fortunately, the situation did improve over the years, and my big a-ha moment was the day I learned about CMake. Out of curiosity, I spent some time digging around in the history of my (relatively large) home framework and tried to figure out when that day was. Turns out, I switched to CMake on the 28th of February, 2008 – over 13 years ago.
Over those 13 years, I did learn to appreciate CMake, and there are several reasons why I still pick CMake as my default build system for C++ projects. The main reason is stability. CMake is one of those projects that has been around for long and is a rather conservative project. Even today it still supports files from 10 years ago. In fact, I’ve been very aggressively moving to new CMake releases as they become stable and never did it fail to build an old CMake project that wasn’t upgraded. In today’s world of “move fast & break things” that’s really refreshing to see.
The fact that it “just works” is more remarkable if you consider the changing environment. Finding dependencies and keeping up with new compilers is a real chore and CMake does an admirable job keeping everything and everyone working.
Finally, CMake is constantly getting updated and doing so in a way that makes modern CMake much simpler and safer, while not breaking existing code. You can easily and gradually migrate and not have to worry. This new way of CMake very much reminds me of how C++ is evolving, and I do enjoy writing new projects from scratch in CMake as it means I can write really simple, easy to understand build files. I’m looking forward to what the next 10 years of CMake will bring, and if you are writing C++ and haven’t used it, I hope you give it a shot!