Lesson 31 · Reference
Glossary
Every term used on this site in one place. Target, generator, cache, policy, preset, usage requirements, and more.
Plain-language definitions of every term this site uses. If a lesson says a word you do not know, this page is where it is defined. Terms link to their full lessons.
A
add_subdirectory. The command that builds a subdirectory’s targets as part of your build. All targets share one namespace. Lesson 15
B
Build directory. The folder (conventionally build/) where CMake writes generated build files. Never commit it. Lesson 4
Build type. Debug, Release, and so on. Chosen at configure time with -DCMAKE_BUILD_TYPE for single-config generators, at build time with --config for multi-config ones. Lesson 21
C
Cache. The file build/CMakeCache.txt that remembers your options between configures. “First set wins” is its core rule. Lesson 16
CMakeLists.txt. The file that describes a CMake project. The only file you write. Lesson 3
Config mode. The find_package strategy that looks for <name>Config.cmake, shipped by the package itself. Lesson 17
Configure. Step one of the CMake cycle. Read CMakeLists.txt, generate build files. Lesson 4
Consumer. Any target that uses your library. In the examples on this site, the executable app is the consumer of the library calc. When a lesson says “consumers get it”, it means “any target that links the library gets it”. Lessons 9 and 10
CPack. CMake’s packaging module. Turns your install() rules into archives and installers. Lesson 24
CTest. CMake’s test driver. Runs your registered tests and reports results. Lesson 25
CMP####. A policy number, for example CMP0079. Policies control behavior changes between CMake versions. Lesson 6
Cross-compiling. Building for a different platform than the one you are on, via a toolchain file. Lesson 26
D
Deprecated. Officially marked for removal. Still works, but will stop. Prefer the documented replacement. Lesson 30
Discouraged. Not formally deprecated, but the official docs recommend against it. For example file(GLOB).
F
FetchContent. The module that downloads a dependency, pinned by commit, and builds it as part of your project. Lesson 18
find_package. The command that locates an installed dependency and provides its imported targets. Lesson 17
G
Generator. Decides what kind of build files CMake produces. Ninja, Makefiles, Visual Studio. Lesson 21
GLOB. A file() mode that collects files by pattern. Officially discouraged for source lists. Lesson 19
I
Imported target. A target that represents an already-built library, from find_package. Linked like your own. fmt::fmt, Threads::Threads. Lesson 14
Interface library. A target with no sources that only carries requirements, headers, flags, standard, to consumers. Lesson 13
INTERFACE. Scope keyword. “Only consumers need this.” Lessons 9 and 10
M
Module mode. The find_package strategy using CMake’s bundled Find*.cmake scripts. Lesson 17
Multi-config generator. One build directory, many build types, chosen with --config. Visual Studio, Ninja Multi-Config. Lesson 21
N
Ninja. The fast, cross-platform build tool that CMake generates files for. The default. Lesson 21
O
Option. A project-defined ON/OFF cache switch. For example option(MYPROJ_BUILD_TESTS ...). Lesson 16
Out-of-source build. Building in a separate directory (-B build) instead of next to your sources. Lesson 4
P
Policy. CMake’s mechanism for behavior changes. Each gets a CMP#### number with OLD and NEW behavior. The project picks by its minimum version. Lesson 6
Preset. A named, committed configuration, configure, build, test, workflow, so everyone runs the same commands. Lesson 20
PRIVATE. Scope keyword. “Only this target needs it.” Lessons 9 and 10
PUBLIC. Scope keyword. “This target and its consumers need it.” Lessons 9 and 10
S
Scope. Where a setting applies. One target, or a target and its consumers. The three keywords PRIVATE, PUBLIC, INTERFACE are the scope system. Lesson 7
Single-config generator. One build directory per build type, chosen at configure time. Ninja, Make. Lesson 21
T
Target. The named unit of a build. An executable, a library, an interface. Everything CMake does happens on targets. Lesson 7
Toolchain file. The file that describes a cross-compiling setup. Compilers, sysroot, target platform. Lesson 26
Transitive, or usage requirements. Requirements that flow from a library to whatever links it. Include dirs, linked libraries, language standard. Lessons 7 and 10
U
Usage requirements. See transitive.