Jethro's Braindump

CMake

tags
C++ Language, The C Language

Introduction

The start to end process according to CMake looks like this:

CMake starts with a human-readable file called CMakeLists.txt that defines what should be built and how, what tests to run and what packages to create. This file is platform-independent.

Typically the project separates the source directory and the binary directory. The source directory is kept tightly under version control.

In-source builds are arrangements where the source and build directories are the same. Having build outputs intermixed with source files leads to significant clutter. This makes working with version control systems more difficult.

Hence, the preference is to have an out-of-source build arrangement. The build directory will be called build.

Generating Project Files

Running CMake reads the CMakeLists.txt file, and creates project files in the build directory. The developer selects the type of project file to be created by choosing a particular project file generator.

Best Practices

  1. Avoid globbing for listing source files