aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-09-17 17:50:09 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-09-17 22:25:37 +0000
commitfaba48d85392ba08c7130e7872e19c65ebbb516a (patch)
treeff0d11f108f24947373638c56f444612472e2f79 /mesonbuild/backend/backends.py
parent9b8ac9db32f245a917c50103cc02154dac30ba70 (diff)
downloadmeson-faba48d85392ba08c7130e7872e19c65ebbb516a.zip
meson-faba48d85392ba08c7130e7872e19c65ebbb516a.tar.gz
meson-faba48d85392ba08c7130e7872e19c65ebbb516a.tar.bz2
backends: Treat build target as generator only when it's the first arg
Otherwise it might be an argument to a script that just inspects the binary itself.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 9bb1a9a..85d5eb6 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -919,9 +919,9 @@ class Backend:
if delta > 0.001:
raise MesonException('Clock skew detected. File {} has a time stamp {:.4f}s in the future.'.format(absf, delta))
- def build_target_to_cmd_array(self, bt):
+ def build_target_to_cmd_array(self, bt, check_cross):
if isinstance(bt, build.BuildTarget):
- if isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
+ if check_cross and isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
if (self.environment.is_cross_build() and
self.environment.exe_wrapper is None and
self.environment.need_exe_wrapper()):
@@ -1061,9 +1061,11 @@ class Backend:
inputs = self.get_custom_target_sources(target)
# Evaluate the command list
cmd = []
+ index = -1
for i in target.command:
+ index += 1
if isinstance(i, build.BuildTarget):
- cmd += self.build_target_to_cmd_array(i)
+ cmd += self.build_target_to_cmd_array(i, (index == 0))
continue
elif isinstance(i, build.CustomTarget):
# GIR scanner will attempt to execute this binary but