Other meanings of CMake
Software build tools
CMake is a cross-platform build system generator that describes software projects independently of a particular compiler or native build tool. It reads configuration files, detects platform capabilities, and produces build files for environments such as Ninja, Unix Makefiles, and Microsoft Visual Studio.1
CMake separates project description from the low-level commands that compile and link a program. A project author declares targets, source files, include directories, libraries, tests, and installation rules in CMakeLists.txt; CMake then generates files for a selected native build tool.1 The generated tool performs the actual compilation, while CMake handles configuration, dependency relationships, platform tests, and build-tree organization. This approach allows one project to support different compilers and operating systems without maintaining an independent hand-written build script for each environment. CMake was developed at Kitware and became particularly prominent in large C and C++ projects, where portability and reproducible configuration are persistent engineering concerns.
CMake projects are organized around targets rather than collections of compiler commands. Commands such as add_executable and add_library define outputs, while target properties express usage requirements, dependencies, compile features, and link relationships.1 Configuration normally occurs in a separate build directory, keeping generated files and cached decisions out of the source tree. Options and detected values are stored in a cache that can be inspected or overridden during subsequent runs. The language is declarative in intent but contains variables, conditionals, functions, and macros, so sophisticated projects can also encode platform-specific logic. Modern practice favors scoped target properties over broad directory-wide settings because they make dependency interfaces clearer.
The selected generator determines which build environment CMake writes, while a toolchain file describes the compiler and target platform used during configuration. Common generators include Ninja, Unix Makefiles, and Visual Studio; the same project can therefore serve command-line, integrated-development-environment, native, and cross-compilation workflows.1 CMake presets provide shareable JSON configuration for common configure, build, test, and package operations, while allowing user-specific settings to remain separate.3 Configuration may also discover dependencies through package configuration files or find-modules. Because generator choice and toolchain selection affect the build tree, changing either commonly requires a fresh build directory rather than silently reusing incompatible generated state.
CMake extends beyond compilation into testing, installation, packaging, and machine-readable tooling. Its CTest companion runs registered tests and can submit results to dashboards, while CPack turns installation rules into distributable archives or platform packages.1 The file API exposes structured information about configured projects to external tools without requiring them to parse human-oriented generator output.4 The CMAKE_EXPORT_COMPILE_COMMANDS option can emit compile_commands.json, a database consumed by language servers, static-analysis tools, and editor integrations.5 These interfaces make CMake useful as project metadata infrastructure, not merely as a one-time script that produces Makefiles.
CMake terminology distinguishes configuration and generation from the subsequent build performed by the selected native tool.
Help improve the encyclopedia. Reports go straight to the site manager.