aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-03-10 19:37:45 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-04-02 00:04:45 +0300
commite5a6283c4cf288fdfc9b43a92bf0ddd74dbf90f8 (patch)
treee3e320069b7665066336305759032b807b67a63c /mesonbuild/build.py
parentd2548e6e839b2058aae7f242db35d6836ccbeef7 (diff)
downloadmeson-e5a6283c4cf288fdfc9b43a92bf0ddd74dbf90f8.zip
meson-e5a6283c4cf288fdfc9b43a92bf0ddd74dbf90f8.tar.gz
meson-e5a6283c4cf288fdfc9b43a92bf0ddd74dbf90f8.tar.bz2
Add MVP implementation of overriding options.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 41e21e3..e46b65f 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -47,6 +47,7 @@ known_basic_kwargs = {'install': True,
'objects': True,
'native': True,
'build_by_default': True,
+ 'override_options': True,
}
# These contain kwargs supported by both static and shared libraries. These are
@@ -305,6 +306,7 @@ class BuildTarget(Target):
self.extra_args = {}
self.generated = []
self.extra_files = []
+ self.option_overrides = {}
# Sources can be:
# 1. Pre-existing source files in the source tree
# 2. Pre-existing sources generated by configure_file in the build tree
@@ -670,6 +672,14 @@ class BuildTarget(Target):
self.pic = kwargs.get('pic', False)
if not isinstance(self.pic, bool):
raise InvalidArguments('Argument pic to static library {!r} must be boolean'.format(self.name))
+ overrides = stringlistify(kwargs.get('override_options', []))
+ for o in overrides:
+ if '=' not in o:
+ raise InvalidArguments('Overrides must be of form "key=value"')
+ k, v = o.split('=', 1)
+ k = k.strip()
+ v = v.strip()
+ self.option_overrides[k] = v
def get_filename(self):
return self.filename