This feature is still under development, while it is recommended and usable and we will try not to break them in future releases, some breaking changes might still happen if necessary to prepare for the Conan 2.0 release.

Available since: 1.33.0

This helper is intended to be used in the build() method, to call Meson commands automatically when a package is being built directly by Conan (create, install)

from import Meson

def build(self):
    meson = Meson(self)

It supports the following methods:


def __init__(self, conanfile):
  • conanfile: the current recipe object. Always use self.


def configure(self, reconfigure=False):

Calls meson, with the given generator and passing either --native-file conan_meson_native.ini (native builds) or --cross-file conan_meson_cross.ini (cross builds). Use tools.meson.mesontoolchain:extra_machine_files=[<FILENAME>] configuration to add your machine files at the end of the command using the correct parameter depending on native or cross builds. See this Meson reference for more information.

  • reconfigure (DEPRECATED)(Optional, Defaulted to False): Adds the --reconfigure parameter to the meson setup command if True.


def build(self, target=None):

Calls the build system. Equivalent to meson compile -C . in the build folder.

  • target (Optional, Defaulted to None): Specifies the target to execute. The default all target will be built if None is specified.


def install(self):

Installs development files (headers, libraries, etc.). Equivalent to run meson install -C . --destdir [CONAN_PACKAGE_FOLDER] in the build folder.

Using –destdir Meson param since Conan 1.64.0


def test(self):

Runs project’s tests. Equivalent to running meson test -v -C . in the build folder. Use to avoid execute this command and skip the tests.


  • (integer) argument for the --jobs parameter when running Ninja.

  •<bool>``(boolean) if ``True running meson test.

  • tools.meson.mesontoolchain:extra_machine_files=["<FILENAME>"] (list of strings) adds your own extra machine files in meson setup command, e.g., meson setup --native-file "conan_meson_native.ini" --native-file "<FILENAME>".