aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-12 23:21:11 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-03-22 17:20:48 -0400
commit8867fb7999e35c6713c46af64becfd1a08146a6a (patch)
treefb077717b3074e6d480c166d7d7fb14ae9e24b62 /mesonbuild/interpreter/interpreter.py
parent999fb3d1e9d4affd95e3ff12039abf787b0b7acf (diff)
downloadmeson-8867fb7999e35c6713c46af64becfd1a08146a6a.zip
meson-8867fb7999e35c6713c46af64becfd1a08146a6a.tar.gz
meson-8867fb7999e35c6713c46af64becfd1a08146a6a.tar.bz2
interpreter: Make compiler options per-subproject
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index ecbfd7a..15d7d32 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -88,6 +88,7 @@ import collections
import typing as T
import textwrap
import importlib
+import copy
if T.TYPE_CHECKING:
import argparse
@@ -1382,6 +1383,15 @@ external dependencies (including libraries) must go to "dependencies".''')
else:
raise
+ # Add per-subproject compiler options. They inherit value from main project.
+ if self.subproject:
+ options = {}
+ for k in comp.get_options():
+ v = copy.copy(self.coredata.options[k])
+ k = k.evolve(subproject=self.subproject)
+ options[k] = v
+ self.coredata.add_compiler_options(options, lang, for_machine, self.environment)
+
if for_machine == MachineChoice.HOST or self.environment.is_cross_build():
logger_fun = mlog.log
else: