Is there a build command for meson?

Well I can init and build a meson with project as:

$ cd /tmp/
$ mkdir foobar; cd foobar
$ meson init --name foobar -l cpp --build
Using "foobar" (project name) as name of executable to build.
Sample project created. To build it run the
following commands:

meson builddir
ninja -C builddir

The Meson build system
Version: 0.53.2
Source dir: /tmp/foobar
Build dir: /tmp/foobar/build
Build type: native build
Project name: foobar
Project version: 0.1
C++ compiler for the host machine: c++ (gcc 9.3.0 "c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0")
C++ linker for the host machine: c++ ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 1

Found ninja-1.10.0 at /usr/bin/ninja
ninja: Entering directory `build'                                                                   
[2/2] Linking target foobar.

But with a created project, I have reading the man page and the website but I can find a command such as $ meson build.

Yes I know there is:

$ cd build
$ ninja

But I think that there is --build in init command…is it other for build?

>Solution :

Once you have configured your build you can do something like:

cd build
meson compile


meson compile -C build

See the docs @:

Leave a Reply