diff options
author | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2016-12-31 02:02:49 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-31 14:08:15 +0200 |
commit | 504f974204c79a08d17224c2a91582a47c64fe68 (patch) | |
tree | 254511602eab073cdfc70e980eb6fbb39dd4e043 | |
parent | 92f8e0ab3162d33276f3ec057c1aa0ff17113052 (diff) | |
download | meson-504f974204c79a08d17224c2a91582a47c64fe68.zip meson-504f974204c79a08d17224c2a91582a47c64fe68.tar.gz meson-504f974204c79a08d17224c2a91582a47c64fe68.tar.bz2 |
Pass project's user options to scan-build temporary project.
This allows (among other things) scan-build to process a project's
optional components that will not get built unless a (user) option has
been set.
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 2f81c3d..70ef254 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2132,11 +2132,17 @@ rule FORTRAN_DEP_HACK gcda_elem.add_item('description', 'Deleting gcda files') gcda_elem.write(outfile) + def get_user_option_args(self): + cmds = [] + for (k, v) in self.environment.coredata.user_options.items(): + cmds.append('-D' + k + '=' + (v.value if isinstance(v.value, str) else str(v.value).lower())) + return cmds + # For things like scan-build and other helper tools we might have. def generate_utils(self, outfile): cmd = [sys.executable, self.environment.get_build_command(), '--internal', 'scanbuild', self.environment.source_dir, self.environment.build_dir, - sys.executable, self.environment.get_build_command()] + sys.executable, self.environment.get_build_command()] + self.get_user_option_args() elem = NinjaBuildElement(self.all_outputs, 'scan-build', 'CUSTOM_COMMAND', 'PHONY') elem.add_item('COMMAND', cmd) elem.add_item('pool', 'console') |