Basics

Definition taken from the CMake website:

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.

So in essence, you configure platform-independent scripts which, when executed, create project structures and workspace structures specific to the platform you are working on. There projects can then be used to work on the files or to simply compile, package and/or install them.

All your CMake work will primarily be stored in a CMakeLists.txt file, unless you are building macro's and modules in separate files, promoting reusability.

If you're familiar with C or C++, you'll know source code is mainly split up in header and source files, preferably organized per application and/or library. The folder structure in the repository section already illustrates this.

In CMake, we basically tell CMake we either want a library or a project and then we tell it which headers and source files to include. If a project requires another project dependency or external library, we need to tell that to CMake aswell.

So CMake needs to know from us:

  • Project structure
  • Application definition
  • Library definition
  • Finding specific external libraries
  • Linking found external libraries
  • Set up subproject dependencies
  • Specify variables, compile and link flags

With those things on our minds, let's start setting up the CMake structure and going through the files step-by-step.

results matching ""

    No results matching ""