Use self-closing <ClCompile> elements where possible; remove trailing newline from </Project>
This commit is contained in:
parent
f94ccff6d0
commit
379de28f74
@ -442,21 +442,33 @@
|
||||
if #files > 0 then
|
||||
_p(1,'<ItemGroup>')
|
||||
for _, file in ipairs(files) do
|
||||
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
|
||||
for cfg in project.eachconfig(prj) do
|
||||
local condition = vc2010.condition(cfg)
|
||||
|
||||
local filecfg = fileconfig.getconfig(file, cfg)
|
||||
vc2010.excludedFromBuild(cfg, filecfg)
|
||||
if filecfg then
|
||||
vc2010.objectFileName(filecfg)
|
||||
vc2010.forceIncludes(filecfg, condition)
|
||||
vc2010.precompiledHeader(cfg, filecfg, condition)
|
||||
vc2010.additionalCompileOptions(filecfg, condition)
|
||||
-- Capture the contents of the <ClCompile> element, if any, so
|
||||
-- I know which form to use.
|
||||
|
||||
local contents = io.capture(function ()
|
||||
for cfg in project.eachconfig(prj) do
|
||||
local condition = vc2010.condition(cfg)
|
||||
|
||||
local filecfg = fileconfig.getconfig(file, cfg)
|
||||
vc2010.excludedFromBuild(cfg, filecfg)
|
||||
if filecfg then
|
||||
vc2010.objectFileName(filecfg)
|
||||
vc2010.forceIncludes(filecfg, condition)
|
||||
vc2010.precompiledHeader(cfg, filecfg, condition)
|
||||
vc2010.additionalCompileOptions(filecfg, condition)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if #contents > 0 then
|
||||
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
|
||||
_p("%s", contents)
|
||||
_p(2,'</ClCompile>')
|
||||
else
|
||||
_x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath))
|
||||
end
|
||||
_p(2,'</ClCompile>')
|
||||
|
||||
end
|
||||
_p(1,'</ItemGroup>')
|
||||
end
|
||||
|
@ -25,7 +25,7 @@
|
||||
vc2010.filters_filegroup(prj, "ResourceCompile")
|
||||
vc2010.filters_filegroup(prj, "CustomBuild")
|
||||
|
||||
_p('</Project>')
|
||||
io.printf('</Project>')
|
||||
end
|
||||
|
||||
|
||||
|
@ -43,8 +43,7 @@
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.c">
|
||||
</ClCompile>
|
||||
<ClCompile Include="hello.c" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@ -153,8 +152,7 @@
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="greetings\hello.cpp">
|
||||
</ClCompile>
|
||||
<ClCompile Include="greetings\hello.cpp" />
|
||||
<ClCompile Include="hello.cpp">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
|
||||
|
Loading…
Reference in New Issue
Block a user