In this blog series i will show some tipps and tricks about cmake, which i want to know before i started with CMake.
My CMake experience
I’ve start using CMake approximately 2 years ago. I’m only developing software for Microsoft Windows with Visual Studio (most of the time VS 2010 x64) and using the build-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++ version at the same time is nearly impossible or rather unmaintainable and that’s only one big point), and so i decide to checkout some build-systems. I quickly realized that the most used one is CMake. But at that time i did not really understand why most C and C++ developer are using it and if it is 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 understand me wrong, CMake is not perfect, it has it’s cons, but the benefits are to huge to ignore.
What is CMake?
CMake is a buildsystem/script language which helps you to build your project. CMake is mainly used for C an C++ project at 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 an run on many OS’s like Windows, MacOS, Linux, …
So what can i do with CMake?
Lots of stuff. You can use it for building your project, but you can also use it for packaging your app too (CPack) which support a wide range of package formats from zip to WiX toolset. CMake can generate makefiles, Visual Studio files, XCode, …., 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 file, clone git repos etc..
What could you expect from the blog series?
I will start with an overview and will port a Visual Studio project to cmake. The following articles will more focus on tipps, tricks and hints and some coding examples.
If you have any wishes or suggestions, please contact me.