vs2010: do not add generated object files to project

MSBuild automatically includes the output objects of the CustomBuildStep
in the link command. If the objects are additionally added to the project,
they will be put twice on the linker command, which leads to LNK4042
warning.
pull/408/head
Nicolas Schneider 9 years ago
parent 2dcac38624
commit 78551ae242
  1. 7
      mesonbuild/backend/vs2010backend.py

@ -493,14 +493,13 @@ class Vs2010Backend(backends.Backend):
for s in gen_src:
relpath = self.relpath(s, target.subdir)
ET.SubElement(inc_src, 'CLCompile', Include=relpath)
if len(objects) + len(gen_objs) > 0:
if len(objects) > 0:
# Do not add gen_objs to project file. Those are automatically used by MSBuild, because they are part of
# the CustomBuildStep Outputs.
inc_objs = ET.SubElement(root, 'ItemGroup')
for s in objects:
relpath = s.rel_to_builddir(proj_to_src_root)
ET.SubElement(inc_objs, 'Object', Include=relpath)
for s in gen_objs:
relpath = self.relpath(s, target.subdir)
ET.SubElement(inc_objs, 'Object', Include=relpath)
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets')
# Reference the regen target.
ig = ET.SubElement(root, 'ItemGroup')

Loading…
Cancel
Save