Reputation: 1
I'm trying to ask here because the Meson community does not respond (my original post there: https://github.com/mesonbuild/meson/discussions/13531)
I have a question about compiler flags (c_args, cpp_args) in the Meson scripts. The flags can be set in a crossfile, for example:
[binaries]
c = ['gcc', '-some_flag=0']
Other possibility is to set the flags in [built-in options] of the same crossfile:
[built-in options]
c_args = ['-some_flag=1']
And then I can set these flags directly in a meson script:
c_args = ['-some_flag=2']
executable('my_app', 'main.c', c_args: c_args)
If I define these flags together as above then the compile command generated by Meson will be (simplified):
gcc -some_flag=0 -some_flag=2 -some_flag=1
I'd expect the flag set in the meson script ('-some_flag=2') to be at the end of the compile command and thus override the definitions from the cross file. Is there some good reason that the flags from [built-in options] are at the end of the compile command?
I'm asking because I'm using some community crossfile that I cannot change. This crossfile has some flags in [built-in options] and I need to override some of the flags in my own meson script. But the Meson puts the flags from [built-in options] at the end of the compile command and thus overrides my flags defined in my meson script.
Upvotes: 0
Views: 35