LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

meson

Fast and user-friendly build system

TLDR

Setup build directory
$ meson setup [builddir]
copy
Configure with options
$ meson setup [builddir] -D[option=value]
copy
Compile project
$ meson compile -C [builddir]
copy
Run tests
$ meson test -C [builddir]
copy
Install project
$ meson install -C [builddir]
copy
Reconfigure
$ meson configure [builddir] -D[option=value]
copy
Wipe and reconfigure build directory
$ meson setup --wipe [builddir]
copy
Create a release build
$ meson setup [builddir] --buildtype=release
copy

SYNOPSIS

meson command [options]

DESCRIPTION

meson is a build system designed to be fast and user-friendly. It reads meson.build project definitions and generates backend build files (ninja by default) for actual compilation.Meson supports C, C++, Rust, Java, Fortran, and other languages. It features automatic dependency detection, cross-compilation support, and built-in unit test and coverage infrastructure. Used by projects like GNOME, systemd, X.Org, and Mesa.

PARAMETERS

COMMAND

Meson subcommand (setup, compile, test, install, configure, dist, subprojects, wrap).
setup DIR
Configure build directory.
compile -C DIR
Build project.
test -C DIR
Run tests.
install -C DIR
Install project.
configure DIR
Change build options without reconfiguring.
dist
Create source distribution tarball.
-D OPT=VAL
Set build option (e.g., -Dbuildtype=release, -Dprefix=/usr).
--buildtype TYPE
Build type: plain, debug, debugoptimized, release, minsize, custom.
--prefix PATH
Installation prefix (default: /usr/local).
--wipe
Wipe and reconfigure existing build directory.
--help
Display help information.

CAVEATS

Requires Python 3 and ninja backend by default. Build directories cannot be reused across different source directories. Out-of-source builds only (cannot build in the source tree). The --wipe flag destroys and recreates the build directory.

HISTORY

Meson was created by Jussi Pakkanen in 2013 as a fast, user-friendly build system.

SEE ALSO

ninja(1), cmake(1), make(1)

Copied to clipboard
Kai