Meson: a build system that reads like documentation
What it does
Meson is an open-source build system that describes a project in a small declarative language and generates the actual build files for a backend, most commonly Ninja. Its selling points are speed of configuration, honest cross-platform behaviour and a syntax that newcomers can read without a manual: targets, dependencies, options, tests and installation rules are declared rather than scripted. On Windows the project publishes an MSI that bundles the interpreter and the pieces needed to start configuring projects immediately, and Meson drives MSVC, Clang, GCC and MinGW toolchains through the same description. It is the build system behind many GNOME components and a growing number of cross-platform C and C++ libraries.
The workflow
The usual cycle is three commands: configure a build directory, compile it, and run the test suite. Configuration detects compilers and dependencies once and caches the result, so reconfiguring after a change is fast, and the build directory can be deleted and regenerated without touching the source tree. Options are set on the command line or through a native file for machine-specific settings, and projects declare their own options so IDE integration can discover them. Installing is a separate step, and distribution packaging is handled through the same declaration, which keeps the developer and packager views aligned.
Practical settings and limits
Meson requires a backend and a compiler to be present; the Windows package brings Meson itself but not MSVC, MinGW or Ninja, so those come from the Visual Studio installer, a package manager, or the project's own tooling. MSVC support is solid for mainstream cases but occasionally lags the newest compiler switches, and projects that need custom build steps heavily may find themselves fighting the declarative model. Because Meson refuses to guess, porting an existing hand-written or CMake build can be a genuine rewrite rather than a translation. IDE integration is good but less universal than for CMake, and the ecosystem of ready-made project templates is smaller.
Who should choose something else
CMake remains the safer choice for maximum toolchain and IDE coverage, and for projects whose dependencies already ship CMake config files. MSBuild and Visual Studio project files are the natural fit for Windows-only .NET or native code that must integrate with the Visual Studio ecosystem. Makefiles and shell scripts still win for small projects where a build system is more overhead than help.
- Best for
- C and C++ projects that want fast configuration and the same build description on every platform.
- Good to know
- The MSI includes Meson but not a compiler or Ninja, so a toolchain must be installed separately.
Meson describes a build in a short, readable language and generates the files a backend such as Ninja executes. One description works with MSVC, Clang and GCC.
How to get started
- Download and run the Windows MSI from the official Meson release page.
- Install a compiler toolchain separately, such as the Visual Studio build tools or a MinGW package.
- Install Ninja if your distribution of Meson did not bundle it.
- Configure a build directory from your source tree with
meson setup builddir. - Compile with
meson compile -C builddirand run the project's tests withmeson test -C builddir.
Questions & answers
Does the installer include a compiler?
No. The MSI provides Meson itself. Compilers, linkers and Ninja come from the Visual Studio installer, MSYS2, or the project's bootstrap script.
Why generate Ninja files instead of building directly?
Separating configuration from execution keeps reconfiguration cheap and lets the backend optimise parallelism. A build directory is disposable.
Can it build Visual Studio solutions?
It can generate a Visual Studio backend for IDE work, though Ninja is faster for command-line builds. Both come from the same project description.
How does it compare with CMake?
Meson is easier to read and configures faster, while CMake has broader IDE and dependency coverage. Projects with large CMake trees rarely move.