Basically I have a cmake subproject as part of my meson.build, I would like to be able to add -DSOMEDEF=4 to the build of that subproject.
Basically I have a cmake subproject as part of my meson.build, I would like to be able to add -DSOMEDEF=4 to the build of that subproject.
You should probably use yield in the meson.options file.
Add the option in your top project:
option('somedef',
type : 'combo',
choices : [
'1',
'2',
'4'
],
description : 'Some def')
Add the same option in your subproject, but with the yield set to true:
option('somedef',
type : 'combo',
choices : [
'1',
'2',
'4'
],
yield : true,
description : 'Some def')
This way the option will be taken from the top project.
In your meson.build add something like (top project):
somedef = get_option('somedef')
and in the subproject:
somedef = get_option('somedef')
if somedef==4
flags += ['-DSOMEDEF=4']
# etc...
endif