From e901581edec38eb3b49c2ba528681a957d18a8df Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Sat, 10 Apr 2021 15:47:37 -0700 Subject: VS: Disable MSBuild warnings for always-generated targets Without this, VS will generate warning MSB8065: Custom build for item "\custom_target.rule" succeeded, but specified output "\outofdate.file" has not been created. This may cause incremental build to work incorrectly. --- mesonbuild/backend/vs2010backend.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mesonbuild/backend') diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 93b7f78..ee58114 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -577,7 +577,8 @@ class Vs2010Backend(backends.Backend): ofilenames += [self.nonexistent_file(os.path.join(self.environment.get_scratch_dir(), 'outofdate.file'))] self.add_custom_build(root, 'custom_target', ' '.join(self.quote_arguments(wrapper_cmd)), - deps=wrapper_cmd[-1:] + srcs + depend_files, outputs=ofilenames) + deps=wrapper_cmd[-1:] + srcs + depend_files, outputs=ofilenames, + verify_files=not target.build_always_stale) ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') self.generate_custom_generator_commands(target, root) self.add_regen_dependency(root) @@ -1490,7 +1491,7 @@ class Vs2010Backend(backends.Backend): self.add_regen_dependency(root) self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) - def add_custom_build(self, node, rulename, command, deps=None, outputs=None, msg=None): + def add_custom_build(self, node, rulename, command, deps=None, outputs=None, msg=None, verify_files=True): igroup = ET.SubElement(node, 'ItemGroup') rulefile = os.path.join(self.environment.get_scratch_dir(), rulename + '.rule') if not os.path.exists(rulefile): @@ -1500,6 +1501,8 @@ class Vs2010Backend(backends.Backend): if msg: message = ET.SubElement(custombuild, 'Message') message.text = msg + if not verify_files: + ET.SubElement(custombuild, 'VerifyInputsAndOutputsExist').text = 'false' cmd_templ = '''setlocal %s if %%errorlevel%% neq 0 goto :cmEnd -- cgit v1.1