diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index 4f4e8c8f..a8aa5d73 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -371,11 +371,17 @@
--
m.elements.linker = function(cfg, explicit)
- return {
- m.link,
- m.lib,
- m.linkLibraryDependencies,
- }
+ if cfg.kind == p.STATICLIB then
+ return {
+ m.lib,
+ m.linkLibraryDependencies,
+ }
+ else
+ return {
+ m.link,
+ m.linkLibraryDependencies,
+ }
+ end
end
function m.linker(cfg)
@@ -386,30 +392,22 @@
m.elements.link = function(cfg, explicit)
- if cfg.kind == p.STATICLIB then
- return {
- m.subSystem,
- m.generateDebugInformation,
- m.optimizeReferences,
- }
- else
- return {
- m.subSystem,
- m.generateDebugInformation,
- m.optimizeReferences,
- m.additionalDependencies,
- m.additionalLibraryDirectories,
- m.importLibrary,
- m.entryPointSymbol,
- m.generateMapFile,
- m.moduleDefinitionFile,
- m.treatLinkerWarningAsErrors,
- m.ignoreDefaultLibraries,
- m.largeAddressAware,
- m.targetMachine,
- m.additionalLinkOptions,
- }
- end
+ return {
+ m.subSystem,
+ m.generateDebugInformation,
+ m.optimizeReferences,
+ m.additionalDependencies,
+ m.additionalLibraryDirectories,
+ m.importLibrary,
+ m.entryPointSymbol,
+ m.generateMapFile,
+ m.moduleDefinitionFile,
+ m.treatLinkerWarningAsErrors,
+ m.ignoreDefaultLibraries,
+ m.largeAddressAware,
+ m.targetMachine,
+ m.additionalLinkOptions,
+ }
end
function m.link(cfg, explicit)
@@ -428,15 +426,13 @@
m.elements.lib = function(cfg, explicit)
- if cfg.kind == p.STATICLIB then
- return {
- m.treatLinkerWarningAsErrors,
- m.targetMachine,
- m.additionalLinkOptions,
- }
- else
- return {}
- end
+ return {
+ m.subSystem,
+ m.optimizeReferences,
+ m.treatLinkerWarningAsErrors,
+ m.targetMachine,
+ m.additionalLinkOptions,
+ }
end
function m.lib(cfg, explicit)
diff --git a/tests/actions/vstudio/vc2010/test_link.lua b/tests/actions/vstudio/vc2010/test_link.lua
index a61838c3..850eb84a 100644
--- a/tests/actions/vstudio/vc2010/test_link.lua
+++ b/tests/actions/vstudio/vc2010/test_link.lua
@@ -105,10 +105,9 @@
kind "StaticLib"
prepare()
test.capture [[
-
+
Windows
- false
-
+
]]
end
@@ -269,14 +268,55 @@
libdirs { "../lib", "../lib64" }
prepare()
test.capture [[
-
+
Windows
- false
-
+
]]
end
+--
+-- Shared libraries do not use Lib tags in Visual Studio and
+-- we should not emit any options like this.
+--
+
+ function suite.sharedLibrariesLinkElement()
+ local real_link = premake.vstudio.vc2010.elements.lib
+ premake.vstudio.vc2010.elements.lib = function(cfg, explicit)
+ return { function(cfg) premake.vstudio.vc2010.element("Test", nil, "Testing") end }
+ end
+ prepare()
+ test.capture [[
+
+ Windows
+ false
+ bin\Debug\MyProject.lib
+
+ ]]
+ premake.vstudio.vc2010.elements.lib = real_link
+ end
+
+
+--
+-- Static libraries do not use Link tags in Visual Studio and
+-- we should not emit any options like this.
+--
+
+ function suite.staticLibrariesLinkElement()
+ kind "StaticLib"
+ local real_link = premake.vstudio.vc2010.elements.link
+ premake.vstudio.vc2010.elements.link = function(cfg, explicit)
+ return { function(cfg) premake.vstudio.vc2010.element("Test", nil, "Testing") end }
+ end
+ prepare()
+ test.capture [[
+
+ Windows
+
+ ]]
+ premake.vstudio.vc2010.elements.link = real_link
+ end
+
--
-- Check handling of the import library settings.
--
@@ -317,11 +357,8 @@
linkoptions { "/kupo" }
prepare()
test.capture [[
-
- Windows
- false
-
+ Windows
/kupo %(AdditionalOptions)
]]
@@ -433,11 +470,8 @@
flags { "FatalLinkWarnings" }
prepare()
test.capture [[
-
- Windows
- false
-
+ Windows
true
]]