gotcha's
- CMake is not:
- A compiler
- A build system
- Cmake indeed:
- Generates the required files for the build system that exists on your operating system, for example on linux it may generate make files, if you're using VSCode it will generate solution files.
- Is an abstraction above the compiler that let's you write CMake instructions on how to build your project without binding yourself to a specific build system such as make
- Makes it possible for you to compile the same code on multiple operating systems, because different operating systems may use different build systems
compiling a program
Because cmake
provides a solution to a complex problem, it is highly configurable, and usually a highly configurable systems make doing simple things a little more involved, indeed this manifests itself in cmake while trying to build a simple project. Here's the breakdown
With cmake we start by generating the build system (on my machine this will create a makefile)
Next we can build the project
For further useful scripts with cmake check my page on them, if you want to learn how to integrate external libraries with cmake check my page on that here