Search code examples
yoctobitbakemeson-build

Bitbake: pass string with spaces to meson config


With meson, it is possible to pass a string with spaces during configuration, e.g. below usage cases are all valid:

meson -Dfoo="bar1 bar2" ...
meson "-Dfoo=bar1 bar2" ...
meson -Dfoo='bar1 bar2' ...
meson '-Dfoo=bar1 bar2' ...

When building a recipe with Bitbake, EXTRA_OEMESON is used to pass configuration parameters to meson. I tried below but they all failed:

Surround the string with "" or ''

EXTRA_OEMESON = " -Dfoo=\"bar1 bar2\" "
# Results in
#meson: error: unrecognized arguments: bar2"

Surround the whole -Dxxx with "" or '':

EXTRA_OEMESON = " \"-Dfoo=bar1 bar2\" "
# Results in
# meson: error: unrecognized arguments: "-Dfoo=bar1 bar2"

So the question is, how to pass such a string with space to meson in bitbake?


Solution

  • Just surrounding the value with quotes should work:

    EXTRA_OEMESON = "-Dfoo='bar1 bar2'"