Search code examples
buildmeson-build

Can meson.build files be divided into distinct files? How?


I would like to split up my meson.build file into multiple files, for ease of management and sharing across projects.

One way to do this might be via subdir. However, I'd rather not put meson.build files throughout my source tree.

Is there another way to accomplish this? Something like import another-meson.build?


Solution

  • Currently the only way to load another build file is via subdir(), or via subproject() and dependency(). In each case, the filename must be meson.build. I believe there was some discussion around the idea of having an include(filename: str) method which would provide the type of behaviour you're after, but I don't recall if there was any traction on that matter.