aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/vs2010backend.py30
-rw-r--r--unittests/allplatformstests.py3
2 files changed, 19 insertions, 14 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)
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index c420340..5b98aa7 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -3066,9 +3066,6 @@ class AllPlatformTests(BasePlatformTests):
self.init(testdir, extra_args=['-Dcmake_prefix_path=' + os.path.join(testdir, 'prefix')])
def test_alias_target(self):
- if self.backend is Backend.vs:
- # FIXME: This unit test is broken with vs backend, needs investigation
- raise SkipTest(f'Skipping alias_target test with {self.backend.name} backend')
testdir = os.path.join(self.unit_test_dir, '65 alias target')
self.init(testdir)
self.build()