Meson
By the Meson project (open source)
Meson is an open-source build system designed for speed and usability, generating native build files for backends like Ninja rather than compiling directly, and using a simple, purpose-built configuration language instead of a…
Definition
Meson is an open-source build system designed for speed and usability, generating native build files for backends like Ninja rather than compiling directly, and using a simple, purpose-built configuration language instead of a general-purpose scripting language. It targets multi-language projects, particularly C and C++ codebases, that need fast, reliable, and cross-platform builds without hand-maintained Makefiles or slow, hard-to-audit legacy build scripts.
Overview
Meson was created in response to long-standing frustration with existing C and C++ build tooling, particularly Autotools and hand-written Makefiles, which are notoriously slow to configure, difficult to read, and hard to make portable across Linux, macOS, and Windows. The project's stated goal was to make the common case of building software fast and easy, favoring convention and clear defaults over the extreme configurability that made older tools complex and error-prone. Mechanically, a Meson project is described in `meson.build` files written in a small, deliberately non-Turing-complete domain-specific language that lists source files, dependencies, and targets. Meson does not compile code itself; instead it acts as a meta-build system, reading these declarations and generating input files for a backend build tool, most commonly Ninja, which then performs the actual, highly parallelized compilation. This separation lets Meson focus on fast configuration and dependency detection while delegating raw build execution to a tool optimized specifically for incremental rebuild speed. Among build systems, Meson occupies a niche similar to CMake, another meta-build system that also generates Ninja or Makefile input, but Meson's configuration language is intentionally simpler and less permissive than CMake's macro-heavy scripting, which advocates argue produces more predictable, easier-to-audit build definitions. Compared to Autotools, Meson configures orders of magnitude faster and requires far less generated boilerplate, though it has a smaller legacy footprint and less tooling built up over decades of use. In practice, Meson has become the build system of choice for several major open-source infrastructure projects, including GNOME, systemd, and Mesa, largely because of its speed on large C and C++ codebases and its clean handling of cross-compilation, which is a persistent pain point for lower-level system software. It also has decent support for other compiled languages, including Rust and Fortran, within the same build description. Meson's limitations stem directly from its design trade-offs: the restricted, non-Turing-complete build language that keeps builds predictable also means genuinely complex or unusual build logic can be awkward or impossible to express without external scripts. It also has a smaller ecosystem of pre-written module support for niche libraries compared to CMake's decades of accumulated find-modules, so teams working with obscure dependencies sometimes need to write their own Meson wrap files or dependency detection logic. Migrating a large, long-established Autotools or CMake project to Meson is also nontrivial, since it typically requires re-describing the entire dependency graph rather than incrementally converting one file at a time.
Key Features
- Meta-build system that generates Ninja or other backend build files
- Purpose-built, non-Turing-complete configuration language
- Fast configuration and highly parallelized incremental builds
- Strong built-in support for cross-compilation targets
- Native support for multiple languages including C, C++, and Rust
- Built-in dependency detection via pkg-config and system libraries
- WrapDB system for fetching and building third-party dependencies
- Designed for readability over the flexibility of scripting-based tools