Joel
Joel

Reputation: 2035

Read a variable from commandline in meson

In my meson.build:

project('coolproject', 'c', version : '1.0.0.0', default_options : ['warning_level=3'])
message('USE_CAIRO=' + get_option('USE_CAIRO'))

I'm trying to read USE_CAIRO like this:

meson setup -DUSE_CAIRO=TRUE --reconfigure

But I get: ERROR: Unknown options: "USE_CAIRO" . Any ideas about how to read custom command line variables?

Upvotes: 0

Views: 35

Answers (1)

Matt
Matt

Reputation: 15081

User options must be declared in meson.options file first:

# meson.options
option('USE_CAIRO', type : boolean, value : true)

Here true is only default value that may be redefined by specific build.

Upvotes: 0

Related Questions