Fix cross file initialization of CPPFLAGS

'c_arg' entries should become *both* compiler options and external
peprocessor options for C. (And likewise for a few other languages.)
Seems inconsistent to me, but this is the status quo.
This commit is contained in:
John Ericson 2019-02-04 17:33:14 -05:00 committed by Dylan Baker
parent d87744138a
commit 9d7f38eccd
1 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,7 @@ from pathlib import PurePath
from collections import OrderedDict
from .mesonlib import (
MesonException, MachineChoice, PerMachine,
default_libdir, default_libexecdir, default_prefix
default_libdir, default_libexecdir, default_prefix, stringlistify
)
from .wrap import WrapMode
import ast
@ -600,6 +600,12 @@ class CoreData:
# Unlike compiler and linker flags, preprocessor flags are not in
# compiler_options because they are not visible to user.
preproc_flags = shlex.split(preproc_flags)
k = lang + '_args'
if lang in ('c', 'cpp', 'objc', 'objcpp') and k in env.properties[for_machine]:
# `c_args` in the cross file are used, like CPPFLAGS but *not*
# CFLAGS, for tests. this is weird, but how it was already
# implemented. Hopefully a new version of #3916 fixes it.
preproc_flags = stringlistify(env.properties[for_machine][k])
self.external_preprocess_args[for_machine].setdefault(lang, preproc_flags)
enabled_opts = []