diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index aaab4550..4903afd9 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -435,24 +435,25 @@ table.concat(premake.esc(cfg.linkoptions), " ")) end end + + local function link_target_machine(index,cfg) + local platforms = {x32 = 'MachineX86',Native = 'MachineX86', x64 = 'MachineX64'} + if platforms[cfg.platform] then + _p(index,'%s', platforms[cfg.platform]) + end + end local function item_def_lib(cfg) if cfg.kind == 'StaticLib' then _p(1,'') _p(2,'$(OutDir)%s',cfg.buildtarget.name) additional_options(2,cfg) + link_target_machine(2,cfg) _p(1,'') end end - local function link_target_machine(cfg) - local target - if cfg.platform == nil or cfg.platform == "x32" then target ="MachineX86" - elseif cfg.platform == "x64" then target ="MachineX64" - end - _p(3,'%s', target) - end local function import_lib(cfg) --Prevent the generation of an import library for a Windows DLL. @@ -499,9 +500,7 @@ end import_lib(cfg) - - _p(3,'%s', iif(cfg.platform == "x64", "MachineX64", "MachineX86")) - + link_target_machine(3,cfg) additional_options(3,cfg) else common_link_section(cfg) diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 55612202..e87d12af 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -180,4 +180,39 @@ test.string_contains(get_buffer(), '.* %%%(AdditionalOptions%).*') end - \ No newline at end of file + + + function vs10_project_kinds.staticLibX64_TargetMachineSetInLib() + kind "StaticLib" + platforms{'x64'} + local buffer = get_buffer() + test.string_contains(buffer,'.*.*.*') + end + + function vs10_project_kinds.staticLibX64_TargetMachineInLibSetToMachineX64() + kind "StaticLib" + platforms{'x64'} + local buffer = get_buffer() + test.string_contains(buffer,'.*MachineX64.*') + end + + function vs10_project_kinds.staticLibX32_TargetMachineSetInLib() + kind "StaticLib" + platforms{'x32'} + local buffer = get_buffer() + test.string_contains(buffer,'.*.*.*') + end + + function vs10_project_kinds.staticLibX32_TargetMachineInLibSetToMachineX86() + kind "StaticLib" + platforms{'x32'} + local buffer = get_buffer() + test.string_contains(buffer,'.*MachineX86.*') + end + + function vs10_project_kinds.staticLibNative_TargetMachineInLibSetToMachineX86() + kind "StaticLib" + platforms{'Native'} + local buffer = get_buffer() + test.string_contains(buffer,'.*MachineX86.*') + end \ No newline at end of file