Reference tables

Compiler ids

These are return values of the get_id (Compiler family) and get_argument_syntax (Argument syntax) method in a compiler object.

ValueCompiler familyArgument syntax
armARM compiler
armclangARMCLANG compiler
ccompThe CompCert formally-verified C compiler
ccrxRenesas RX Family C/C++ compiler
clangThe Clang compilergcc
clang-clThe Clang compiler (MSVC compatible driver)msvc
dmdD lang reference compiler
emscriptenEmscripten WASM compiler
flangFlang Fortran compiler
g95The G95 Fortran compiler
gccThe GNU Compiler Collectiongcc
intelIntel compiler (Linux and Mac)gcc
intel-clIntel compiler (Windows)msvc
intel-llvmIntel oneAPI LLVM-based compiler
intel-llvm-clIntel oneAPI LLVM-based compiler (Windows)msvc
lccElbrus C/C++/Fortran Compiler
llvmLLVM-based compiler (Swift, D)
monoXamarin C# compiler
mwccarmMetrowerks C/C++ compiler for Embedded ARM
mwcceppcMetrowerks C/C++ compiler for Embedded PowerPC
msvcMicrosoft Visual Studiomsvc
nagforThe NAG Fortran compiler
nvidia_hpcNVidia HPC SDK compilers
nvccNVidia CUDA compiler
open64The Open64 Fortran Compiler
pathscaleThe Pathscale Fortran compiler
pgiPortland PGI C/C++/Fortran compilers
rustcRust compiler
sunSun Fortran compiler
c2000Texas Instruments C/C++ Compiler (C2000)
c6000Texas Instruments C/C++ Compiler (C6000)
tiTexas Instruments C/C++ Compiler
valacVala compiler
xc16Microchip XC16 C compiler
cythonThe Cython compiler
nasmThe NASM compiler (Since 0.64.0)
yasmThe YASM compiler (Since 0.64.0)
mlMicrosoft Macro Assembler for x86 and x86_64 (Since 0.64.0)msvc
armasmMicrosoft Macro Assembler for ARM and AARCH64 (Since 0.64.0)
mwasmarmMetrowerks Assembler for Embedded ARM
mwasmeppcMetrowerks Assembler for Embedded PowerPC

Linker ids

These are return values of the get_linker_id method in a compiler object.

ValueLinker family
ld.bfdThe GNU linker
ld.goldThe GNU gold linker
ld.lldThe LLVM linker, with the GNU interface
ld.moldThe fast MOLD linker
ld.solarisSolaris and illumos
ld.wasmemscripten's wasm-ld linker
ld64Apple ld64
ld64.lldThe LLVM linker, with the ld64 interface
linkMSVC linker
lld-linkThe LLVM linker, with the MSVC interface
xilinkUsed with Intel-cl only, MSVC like
optlinkoptlink (used with DMD)
rlinkThe Renesas linker, used with CCrx only
xc16-arThe Microchip linker, used with XC16 only
ar2000The Texas Instruments linker, used with C2000 only
ti-arThe Texas Instruments linker
ar6000The Texas Instruments linker, used with C6000 only
armlinkThe ARM linker (arm and armclang compilers)
pgiPortland/Nvidia PGI
nvlinkNvidia Linker used with cuda
ccompCompCert used as the linker driver
mwldarmThe Metrowerks Linker with the ARM interface, used with mwccarm only
mwldeppcThe Metrowerks Linker with the PowerPC interface, used with mwcceppc only

For languages that don't have separate dynamic linkers such as C# and Java, the get_linker_id will return the compiler name.

Script environment variables

ValueComment
MESONINTROSPECTCommand to run to run the introspection command, may be of the form python /path/to/meson introspect, user is responsible for splitting the path if necessary.
MESONREWRITECommand to run to run the rewriting command, only set when running dist scripts
MESON_BUILD_ROOTAbsolute path to the build dir
MESON_DIST_ROOTPoints to the root of the staging directory, only set when running dist scripts
MESON_SOURCE_ROOTAbsolute path to the source dir
MESON_SUBDIRCurrent subdirectory, only set for run_command

CPU families

These are returned by the cpu_family method of build_machine, host_machine and target_machine. For cross compilation they are set in the cross file.

ValueComment
aarch6464 bit ARM processor
alphaDEC Alpha processor
arc32 bit ARC processor
arm32 bit ARM processor
avrAtmel AVR processor
c200032 bit C2000 processor
c600032 bit C6000 processor
csky32 bit CSky processor
dspic16 bit Microchip dsPIC
e2kMCST Elbrus processor
ft3232 bit Bridgetek MCU
ia64Itanium processor
loongarch6464 bit Loongson processor
m68kMotorola 68000 processor
microblazeMicroBlaze processor
mips32 bit MIPS processor
mips6464 bit MIPS processor
msp43016 bit MSP430 processor
pariscHP PA-RISC processor
pic2416 bit Microchip PIC24
ppc32 bit PPC processors
ppc6464 bit PPC processors
riscv3232 bit RISC-V Open ISA
riscv6464 bit RISC-V Open ISA
rl78Renesas RL78
rxRenesas RX 32 bit MCU
s390IBM zSystem s390
s390xIBM zSystem s390x
sh4SuperH SH-4
sparc32 bit SPARC
sparc64SPARC v9 processor
sw_6464 bit sunway processor
wasm3232 bit Webassembly
wasm6464 bit Webassembly
x8632 bit x86 processor
x86_6464 bit x86 processor

Any cpu family not listed in the above list is not guaranteed to remain stable in future releases.

Those porting from autotools should note that Meson does not add endianness to the name of the cpu_family. For example, autotools will call little endian PPC64 “ppc64le”, Meson will not, you must also check the .endian() value of the machine for this information.

Operating system names

These are provided by the .system() method call.

ValueComment
androidBy convention only, subject to change
cygwinThe Cygwin environment for Windows
darwinEither OSX or iOS
dragonflyDragonFly BSD
emscriptenEmscripten's JavaScript environment
freebsdFreeBSD and its derivatives
gnuGNU Hurd
haiku
linux
netbsd
openbsd
windowsAny version of Windows
sunosillumos and Solaris

Any string not listed above is not guaranteed to remain stable in future releases.

Kernel names (since 1.2.0)

Native names as returned by the .kernel() method.

ValueComment
linux
freebsd
openbsd
netbsd
nt
xnuKernel of various Apple OSes
illumosKernel derived from OpenSolaris by community efforts
solarisKernel derived from OpenSolaris by Oracle
dragonfly
haiku
noneFor e.g. bare metal embedded

Subsystem names (since 1.2.0)

A more specific description of the system in question. Most values are meant to be used in cross files only, as those platforms can not run Meson natively.

ValueComment
macosApple macOS (formerly OSX)
iosApple iOS
ios-simulator
tvosApple tvOS
tvos-simulator
watchosApple watchOS
watchos-simulator

Language arguments parameter names

These are the parameter names for passing language specific arguments to your build target.

Languagecompiler namelinker name
Cc_argsc_link_args
C++cpp_argscpp_link_args
C#cs_argscs_link_args
CUDAcuda_argscuda_link_args
Dd_argsd_link_args
Fortranfortran_argsfortran_link_args
Javajava_argsjava_link_args
Objective Cobjc_argsobjc_link_args
Objective C++objcpp_argsobjcpp_link_args
Rustrust_argsrust_link_args
Valavala_argsvala_link_args
Cythoncython_argscython_link_args
NASMnasm_argsN/A
MASMmasm_argsN/A

All these <lang>_* options are specified per machine. See in specifying options per machine for on how to do this in cross builds.

Compiler and linker flag environment variables

These environment variables will be used to modify the compiler and linker flags.

It is recommended that you do not use these. They are provided purely to for backwards compatibility with other build systems. There are many caveats to their use, especially when rebuilding the project. It is highly recommended that you use the command line arguments instead.

NameComment
CFLAGSFlags for the C compiler
CXXFLAGSFlags for the C++ compiler
CUFLAGSFlags for the CUDA compiler
OBJCFLAGSFlags for the Objective C compiler
FFLAGSFlags for the Fortran compiler
DFLAGSFlags for the D compiler
VALAFLAGSFlags for the Vala compiler
RUSTFLAGSFlags for the Rust compiler
CYTHONFLAGSFlags for the Cython compiler
LDFLAGSThe linker flags, used for all languages

N.B. these settings are specified per machine, and so the environment variables actually come in pairs. See the environment variables per machine section for details.

Function Attributes

These are the parameters names that are supported using compiler.has_function_attribute() or compiler.get_supported_function_attributes()

GCC __attribute__

These values are supported using the GCC style __attribute__ annotations, which are supported by GCC, Clang, and other compilers.

Name
alias
aligned
alloc_size
always_inline
artificial
cold
const
constructor
constructor_priority
deprecated
destructor
error
externally_visible
fallthrough
flatten
format
format_arg
force_align_arg_pointer³
gnu_inline
hot
ifunc
malloc
noclone
noinline
nonnull
noreturn
nothrow
null_terminated_string_arg⁷
optimize
packed
pure
retain⁴
returns_nonnull
section⁵
sentinel⁵
unused
used
vector_size⁶
visibility*
visibility:default†
visibility:hidden†
visibility:internal†
visibility:protected†
warning
warn_unused_result
weak
weakref

* Changed in 0.52.0 the “visibility” target no longer includes “protected”, which is not present in Apple's clang.

New in 0.52.0 These split visibility attributes are preferred to the plain “visibility” as they provide narrower checks.

³ New in 0.55.0

New in 0.62.0

New in 0.63.0

New in 1.1.0

New in 1.5.0

MSVC __declspec

These values are supported using the MSVC style __declspec annotation, which are supported by MSVC, GCC, Clang, and other compilers.

Name
dllexport
dllimport

Dependency lookup methods

These are the values that can be passed to dependency function's method keyword argument.

NameComment
autoAutomatic method selection
pkg-configUse Pkg-Config
cmakeLook up as a CMake module
config-toolUse a custom dep tool such as cups-config
systemSystem provided (e.g. OpenGL)
extraframeworkA macOS/iOS framework

Compiler and Linker selection variables

N.B. these settings are specified per machine, and so the environment variables actually come in pairs. See the environment variables per machine section for details.

LanguageCompilerLinkerNote
CCCCC_LD
C++CXXCXX_LD
DDCDC_LDBefore 0.54 D_LD*
FortranFCFC_LDBefore 0.54 F_LD*
Objective-COBJCOBJC_LD
Objective-C++OBJCXXOBJCXX_LDBefore 0.54 OBJCPP_LD*
RustRUSTCRUSTC_LDBefore 0.54 RUST_LD*
ValaVALACUse CC_LD. Vala transpiles to C
C#CSCCSCThe linker is the compiler
CythonCYTHON
nasmNASMUses the C linker

*The old environment variables are still supported, but are deprecated and will be removed in a future version of Meson.

changed in 1.3.0 Paths with spaces were split unconditionally to extract components such as the path to Ccache, intrinsic compiler flags like -m32 or --target, etc. This broke passing a hardcoded compiler path to CMake subprojects. To work around this, paths must be wrapped with double quotes:

export CC='"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"'

You can also set the values through machine files.

New in 1.3.0 Paths that point to an existing executable no longer need wrapping:

export CC='C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe'

Environment variables per machine

Since 0.54.0, Following Autotool and other legacy build systems, environment variables that affect machine-specific settings come in pairs: for every bare environment variable FOO, there is a suffixed FOO_FOR_BUILD, where FOO just affects the host machine configuration, while FOO_FOR_BUILD just affects the build machine configuration. For example:

  • PKG_CONFIG_PATH_FOR_BUILD controls the paths pkg-config will search for just native: true dependencies (build machine).

  • PKG_CONFIG_PATH controls the paths pkg-config will search for just native: false dependencies (host machine).

This mirrors the build. prefix used for (built-in) Meson options, which has the same meaning.

This is useful for cross builds. In the native builds, build = host, and the unsuffixed environment variables alone will suffice.

Prior to 0.54.0, there was no _FOR_BUILD-suffixed variables, and most environment variables only effected native machine configurations, though this wasn't consistent (e.g. PKG_CONFIG_PATH still affected cross builds).