gnome: Don't assume that a C compiler is being used
@@ -443,12 +443,18 @@ class GnomeModule(ExtensionModule):
'Gir includes must be str, GirTarget, or list of them')
cflags = []
- if state.global_args.get('c'):
- cflags += state.global_args['c']
- if state.project_args.get('c'):
- cflags += state.project_args['c']
- if 'c' in state.compilers:
- compiler = state.compilers['c']
+ for lang, compiler in girtarget.compilers.items():
+ # XXX: Can you use g-i with any other language?
+ if lang in ('c', 'cpp', 'objc', 'objcpp', 'd'):
+ break
+ else:
+ lang = None
+ compiler = None
+ if lang and compiler:
+ if state.global_args.get(lang):
+ cflags += state.global_args[lang]
+ if state.project_args.get(lang):
+ cflags += state.project_args[lang]
sanitize = compiler.get_options().get('b_sanitize')
if sanitize:
cflags += compilers.sanitizer_compile_args(sanitize)
