diff options
author | Andres Freund <andres@anarazel.de> | 2021-09-13 14:16:24 -0700 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-09-14 13:38:04 -0400 |
commit | fddf88ba08e4211b8793964efb0461725bdacd21 (patch) | |
tree | c799fdec3c1d0e0c02aea1f8c21b5897562169ae /mesonbuild/backend/vs2010backend.py | |
parent | 214d03568f75fbd578cc97d46f48d5d882f3870b (diff) | |
download | meson-fddf88ba08e4211b8793964efb0461725bdacd21.zip meson-fddf88ba08e4211b8793964efb0461725bdacd21.tar.gz meson-fddf88ba08e4211b8793964efb0461725bdacd21.tar.bz2 |
backends/vs: Do not emit dummy command for alias_command().
Alias commands did not work with the vs backend, due to trying to access
target.command[0] with an empty command. Fix this by just not emitting a
CustomBuild node for alias targets - the project references are enough to
trigger the necessary actions.
Fixes: #9247
Diffstat (limited to 'mesonbuild/backend/vs2010backend.py')
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 13cd546..4dc4679 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -27,7 +27,7 @@ from .. import mlog from .. import compilers from ..interpreter import Interpreter from ..mesonlib import ( - File, MesonException, python_command, replace_if_different, OptionKey, version_compare, MachineChoice + File, MesonException, replace_if_different, OptionKey, version_compare, MachineChoice ) from ..environment import Environment, build_filename @@ -550,19 +550,27 @@ class Vs2010Backend(backends.Backend): def gen_run_target_vcxproj(self, target, ofname, guid): root = self.create_basic_crap(target, guid) + depend_files = self.get_custom_target_depend_files(target) + if not target.command: - # FIXME: This is an alias target that doesn't run any command, there - # is probably a better way than running a this dummy command. - cmd_raw = python_command + ['-c', 'exit'] + # This is an alias target and thus doesn't run any command. It's + # enough to emit the references to the other projects for them to + # be built/run/..., if necessary. + assert isinstance(target, build.AliasTarget) + assert len(depend_files) == 0 else: + assert not isinstance(target, build.AliasTarget) + + target_env = self.get_run_target_env(target) _, _, cmd_raw = self.eval_custom_target_command(target) - depend_files = self.get_custom_target_depend_files(target) - target_env = self.get_run_target_env(target) - wrapper_cmd, _ = self.as_meson_exe_cmdline(target.command[0], cmd_raw[1:], - force_serialize=True, env=target_env, - verbose=True) - self.add_custom_build(root, 'run_target', ' '.join(self.quote_arguments(wrapper_cmd)), - deps=depend_files) + wrapper_cmd, _ = self.as_meson_exe_cmdline(target.command[0], cmd_raw[1:], + force_serialize=True, env=target_env, + verbose=True) + self.add_custom_build(root, 'run_target', ' '.join(self.quote_arguments(wrapper_cmd)), + deps=depend_files) + + # The import is needed even for alias targets, otherwise the build + # target isn't defined ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') self.add_regen_dependency(root) self.add_target_deps(root, target) |