diff --git a/modules/vstudio/tests/vc2010/test_compile_settings.lua b/modules/vstudio/tests/vc2010/test_compile_settings.lua
index 997dcf23..605ec759 100644
--- a/modules/vstudio/tests/vc2010/test_compile_settings.lua
+++ b/modules/vstudio/tests/vc2010/test_compile_settings.lua
@@ -1546,6 +1546,45 @@
NotUsing
Level3
Disabled
+
+ ]]
+ end
+
+--
+-- If removeUnreferencedCodeData flag is set, add element
+--
+
+ function suite.onRemoveUnreferencedCodeDataOff()
+ removeunreferencedcodedata "Off"
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+ false
+ ]]
+ end
+
+ function suite.onRemoveUnreferencedCodeDataOn()
+ removeunreferencedcodedata "On"
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
+ true
+ ]]
+ end
+
+ function suite.onRemoveUnreferencedCodeDataNotSpecified()
+ prepare()
+ test.capture [[
+
+ NotUsing
+ Level3
+ Disabled
]]
end
\ No newline at end of file
diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua
index 39cdcc85..b87dc1a8 100644
--- a/modules/vstudio/vs2010_vcxproj.lua
+++ b/modules/vstudio/vs2010_vcxproj.lua
@@ -386,7 +386,8 @@
m.languageStandard,
m.conformanceMode,
m.structMemberAlignment,
- m.useFullPaths
+ m.useFullPaths,
+ m.removeUnreferencedCodeData
}
if cfg.kind == p.STATICLIB then
@@ -1515,6 +1516,16 @@
end
end
+ function m.removeUnreferencedCodeData(cfg)
+ if cfg.removeUnreferencedCodeData ~= nil then
+ if cfg.removeUnreferencedCodeData then
+ m.element("RemoveUnreferencedCodeData", nil, "true")
+ else
+ m.element("RemoveUnreferencedCodeData", nil, "false")
+ end
+ end
+ end
+
function m.additionalCompileOptions(cfg, condition)
local opts = cfg.buildoptions
if _ACTION == "vs2015" or vstudio.isMakefile(cfg) then
diff --git a/src/_premake_init.lua b/src/_premake_init.lua
index d47aedef..67e32f1a 100644
--- a/src/_premake_init.lua
+++ b/src/_premake_init.lua
@@ -795,6 +795,12 @@
kind = "boolean"
}
+ api.register {
+ name = "removeunreferencedcodedata",
+ scope = "config",
+ kind = "boolean"
+ }
+
api.register {
name = "swiftversion",
scope = "config",
diff --git a/website/docs/removeunreferencedcodedata.md b/website/docs/removeunreferencedcodedata.md
new file mode 100644
index 00000000..034671b1
--- /dev/null
+++ b/website/docs/removeunreferencedcodedata.md
@@ -0,0 +1,30 @@
+Sets the `RemoveUnreferencedCodeData` property for a configuration or all configurations within a project or workspace, adding or removing the `/Zc:inline[-]` build option.
+
+[/Zc:inline (Remove unreferenced COMDAT)](https://docs.microsoft.com/en-us/cpp/build/reference/zc-inline-remove-unreferenced-comdat?view=msvc-160)
+
+If this property is unset, it defaults to `true` in Visual Studio.
+
+```lua
+removeunreferencedcodedata ("value")
+```
+
+### Parameters ###
+
+`value` one of:
+* `on` - Enables `RemoveUnreferencedCodeData`.
+* `off` - Disables `RemoveUnreferencedCodeData`.
+
+### Applies To ###
+
+Workspaces and projects.
+
+### Availability ###
+
+Premake 5.0 alpha 16 or later.
+
+### Examples ###
+
+```lua
+RemoveUnreferencedCodeData "Off"
+```
+
diff --git a/website/sidebars.js b/website/sidebars.js
index 981f0d90..50e2e138 100644
--- a/website/sidebars.js
+++ b/website/sidebars.js
@@ -192,6 +192,7 @@ module.exports = {
'project',
'propertydefinition',
'rebuildcommands',
+ 'removeunreferencedcodedata',
'resdefines',
'resincludedirs',
'resoptions',