meson
meson copied to clipboard
Dependency compile_args cannot carry language-specific arguments
Currently, a dep object created via declare_dependency can supply compilation arguments through the compile_args: field.
These appear to be applied the same regardless of the language of the build target.
This can be a problem in mixed C/C++ builds for example:
foo_dep = declare_dependency(
link_with: foo_lib,
compile_args: [
'-Wno-register', # Valid for `g++` where `register` isn't a keyword; invalid for `gcc` though
],
)
c_lib = library(..., dependency: foo_dep) # Breaks due to `-Wregister`
cpp_lib = library(..., dependency: foo_dep) # No problems
What's the motivation behind compile_args? Would it be possible to introduce a per-language version of compile_args,
e.g. by using the same <lang>_args syntax available to build-target calls? Or, is it simply recommended to avoid the
use of compile_args itself?
There is an issue open somewhere about this that I'm assigned to...
Long story short this is known and I'm going to fix it.
The longer story is this is a leaky abstraction over pkg-config
#5723
Perhaps close this as a duplicate of gh-5723?