diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index 154c3597..e2a8c0e8 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -398,6 +398,7 @@
end
vc200x.additionalIncludeDirectories(cfg, cfg.includedirs)
+ vc200x.wholeProgramOptimization(cfg)
vc200x.preprocessorDefinitions(cfg, cfg.defines)
vc200x.minimalRebuild(cfg)
@@ -923,6 +924,13 @@
end
+ function vc200x.wholeProgramOptimization(cfg)
+ if cfg.flags.LinkTimeOptimization then
+ _x(4,'WholeProgramOptimization="true"')
+ end
+ end
+
+
function vc200x.additionalLibraryDirectories(cfg)
if #cfg.libdirs > 0 then
local dirs = table.concat(project.getrelative(cfg.project, cfg.libdirs), ";")
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index bb58cdf5..33aa2d0c 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -171,6 +171,7 @@
"useOfMfc",
"clrSupport",
"characterSet",
+ "wholeProgramOptimization",
"nmakeOutDirs",
}
@@ -644,6 +645,11 @@
end
end
+ function vc2010.wholeProgramOptimization(cfg)
+ if cfg.flags.LinkTimeOptimization then
+ _p(2,'true')
+ end
+ end
function vc2010.clCompileAdditionalIncludeDirectories(cfg)
vc2010.additionalIncludeDirectories(cfg, cfg.includedirs)
diff --git a/src/base/api.lua b/src/base/api.lua
index 61472d0a..46e158fa 100644
--- a/src/base/api.lua
+++ b/src/base/api.lua
@@ -713,6 +713,7 @@
"FatalWarnings",
"FloatFast",
"FloatStrict",
+ "LinkTimeOptimization",
"Managed",
"MFC",
"MultiProcessorCompile",
diff --git a/tests/actions/vstudio/vc200x/test_compiler_block.lua b/tests/actions/vstudio/vc200x/test_compiler_block.lua
index 28136ef4..143902e9 100644
--- a/tests/actions/vstudio/vc200x/test_compiler_block.lua
+++ b/tests/actions/vstudio/vc200x/test_compiler_block.lua
@@ -572,3 +572,19 @@
RuntimeLibrary="0"
]]
end
+
+--
+-- Check the LinkTimeOptimization flag.
+--
+
+ function suite.flags_onLinkTimeOptimization()
+ flags { "LinkTimeOptimization" }
+ prepare()
+ test.capture [[
+
]]
end
+
+
+--
+-- Check the LinkTimeOptimization flag
+--
+
+ function suite.useOfLinkTimeOptimization()
+ flags { "LinkTimeOptimization" }
+ prepare()
+ test.capture [[
+
+ Application
+ false
+ MultiByte
+ true
+ ]]
+ end
\ No newline at end of file