diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index c0cc3614..ac15f296 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -343,6 +343,7 @@
m.additionalCompileOptions,
m.compileAs,
m.callingConvention,
+ m.languageStandard,
}
end
@@ -1084,9 +1085,28 @@
end
+ function m.languageStandard(cfg)
+ if _ACTION >= "vs2017" then
+ if (cfg.cppdialect == "C++14") then
+ m.element("LanguageStandard", nil, 'stdcpp14')
+ elseif (cfg.cppdialect == "C++17") then
+ m.element("LanguageStandard", nil, 'stdcpplatest')
+ end
+ end
+ end
+
+
function m.additionalCompileOptions(cfg, condition)
- if #cfg.buildoptions > 0 then
- local opts = table.concat(cfg.buildoptions, " ")
+ local opts = cfg.buildoptions
+ if _ACTION == "vs2015" then
+ if (cfg.cppdialect == "C++14") then
+ table.insert(opts, "/std:c++14")
+ elseif (cfg.cppdialect == "C++17") then
+ table.insert(opts, "/std:c++latest")
+ end
+ end
+ if #opts > 0 then
+ opts = table.concat(opts, " ")
m.element("AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
end
end
diff --git a/tests/actions/vstudio/vc2010/test_compile_settings.lua b/tests/actions/vstudio/vc2010/test_compile_settings.lua
index af44e971..563f6bd2 100644
--- a/tests/actions/vstudio/vc2010/test_compile_settings.lua
+++ b/tests/actions/vstudio/vc2010/test_compile_settings.lua
@@ -1068,3 +1068,92 @@
]]
end
+
+
+--
+-- Check handling of the C++14 & C++17 api
+--
+
+ function suite.onLanguage_Cpp14_VS2010()
+ cppdialect 'C++14'
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+
+ ]]
+ end
+
+ function suite.onLanguage_Cpp14_VS2015()
+ p.action.set("vs2015")
+
+ cppdialect 'C++14'
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+ /std:c++14 %(AdditionalOptions)
+
+ ]]
+ end
+
+ function suite.onLanguage_Cpp14_VS2017()
+ p.action.set("vs2017")
+
+ cppdialect 'C++14'
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+ stdcpp14
+
+ ]]
+ end
+
+ function suite.onLanguage_Cpp17_VS2010()
+ cppdialect 'C++17'
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+
+ ]]
+ end
+
+ function suite.onLanguage_Cpp17_VS2015()
+ p.action.set("vs2015")
+
+ cppdialect 'C++17'
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+ /std:c++latest %(AdditionalOptions)
+
+ ]]
+ end
+
+ function suite.onLanguage_Cpp17_VS2017()
+ p.action.set("vs2017")
+
+ cppdialect 'C++17'
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+ stdcpplatest
+
+ ]]
+ end