CMake

Notes

  • CMake commands are case insensitive.
  • CMake variables are case sensitive.
  • First line of CMakeLists.txt must be cmake_minimum_required.

Workflow

Configure - Generate build files

Once you’ve run the configure command cmake -B build, you don’t have to run it again, even when making changes to your CMakeLists.txt file.

Simply running cmake --build build will cause CMake to check whether there are any changes and run the configure step again automatically.

cmake -S . -B build
# or
cmake -B build

Build

cmake --build build