Merge pull request #1789 from LoneBoco/bugfix-externalwarning

Include the configuration condition for ExternalWarningLevel.
This commit is contained in:
Samuel Surtees 2022-02-22 22:22:11 +10:00 committed by GitHub
commit 1b8ef89cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 2 deletions

View File

@ -25,6 +25,11 @@ local function prepare(platform)
vc2010.clCompile(cfg)
end
local function prepareFiles(platform)
prj = test.getproject(wks, 1)
vc2010.files(prj)
end
--
-- Check ClCompile for ExternalWarningLevel
--
@ -88,6 +93,19 @@ function suite.ExternalWarningLevelEverything()
]]
end
function suite.ExternalWarningLevelOnFile()
files { "hello1.cpp", "hello2.cpp" }
filter { "files:hello2.cpp" }
externalwarnings "High"
prepareFiles()
test.capture [[
<ItemGroup>
<ClCompile Include="hello1.cpp" />
<ClCompile Include="hello2.cpp">
<ExternalWarningLevel>Level4</ExternalWarningLevel>
]]
end
--
-- Check ClCompile for TreatAngleIncludeAsExternal
--
@ -116,3 +134,29 @@ function suite.TreatAngleIncludeAsExternalOff()
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
]]
end
function suite.TreatAngleIncludeAsExternalOnFile()
files { "hello1.cpp", "hello2.cpp" }
filter { "files:hello2.cpp" }
externalanglebrackets "On"
prepareFiles()
test.capture [[
<ItemGroup>
<ClCompile Include="hello1.cpp" />
<ClCompile Include="hello2.cpp">
<TreatAngleIncludeAsExternal>true</TreatAngleIncludeAsExternal>
]]
end
function suite.TreatAngleIncludeAsExternalOffFile()
files { "hello1.cpp", "hello2.cpp" }
filter { "files:hello2.cpp" }
externalanglebrackets "Off"
prepareFiles()
test.capture [[
<ItemGroup>
<ClCompile Include="hello1.cpp" />
<ClCompile Include="hello2.cpp">
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
]]
end

View File

@ -821,7 +821,7 @@
m.runtimeTypeInfo,
m.warningLevelFile,
m.compileAsWinRT,
m.externalWarningLevel,
m.externalWarningLevelFile,
m.externalAngleBrackets,
}
else
@ -2867,7 +2867,17 @@
end
function m.externalAngleBrackets(cfg)
function m.externalWarningLevelFile(cfg, condition)
if _ACTION >= "vs2022" then
if cfg.externalwarnings then
local map = { Off = "TurnOffAllWarnings", High = "Level4", Extra = "Level4", Everything = "Level4" }
m.element("ExternalWarningLevel", condition, map[cfg.externalwarnings] or "Level3")
end
end
end
function m.externalAngleBrackets(cfg, condition)
if _ACTION >= "vs2022" then
if cfg.externalanglebrackets == p.OFF then
m.element("TreatAngleIncludeAsExternal", condition, "false")