In this blog series, I will show some tips and tricks about CMake, which I wish I had known before I started with CMake.

My CMake Experience Link to heading

I started using CMake approximately 2 years ago. I only develop software for Microsoft Windows with Visual Studio (most of the time VS 2010 x64) and was using the built-in project management from Visual Studio. But with the growing size of my project, Visual Studio’s mouse-click/declarative approach was very painful and inflexible (supporting multiple Visual Studio/VC++ versions at the same time is nearly impossible or rather unmaintainable, and that’s only one big point). So, I decided to check out some build systems. I quickly realized that the most used one is CMake. At that time, I did not really understand why most C and C++ developers were using it and whether it was a good decision for a Windows-only project to switch to CMake.

Long story short, switch to CMake. It doesn’t matter how big or small your project is or if it is a Windows-only project (or another single-OS project). Don’t get me wrong, CMake is not perfect; it has its cons, but the benefits are too huge to ignore.

What is CMake? Link to heading

CMake is a build system/script language that helps you build your project. CMake is mainly used for C and C++ projects of any size and is the de facto standard build system (starting with 3.8, it will also support C#). It is a platform-independent language and runs on many OSs like Windows, macOS, Linux, etc.

So What Can I Do with CMake? Link to heading

Lots of stuff. You can use it for building your project, but you can also use it for packaging your app (CPack), which supports a wide range of package formats from zip to WiX toolset. CMake can generate makefiles, Visual Studio files, XCode, etc., so your code is mainly independent of your used platform (OS-specific build system) and you can switch between different compiler versions easily. You can download files, clone Git repositories, etc.

What Can You Expect from the Blog Series? Link to heading

I will start with an overview and will port a Visual Studio project to CMake. The following articles will focus more on tips, tricks, and hints, and some coding examples.

If you have any wishes or suggestions, please contact me.