diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index b475e9e0..247c515e 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -406,7 +406,7 @@
function cpp.targetconfig(cfg)
local targetinfo = config.gettargetinfo(cfg)
- _p(' OBJDIR = %s', make.esc(cfg.objdir))
+ _p(' OBJDIR = %s', make.esc(project.getrelative(cfg.project, cfg.objdir)))
_p(' TARGETDIR = %s', make.esc(targetinfo.directory))
_p(' TARGET = $(TARGETDIR)/%s', make.esc(targetinfo.name))
end
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index bbf83eb8..fc521585 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -143,7 +143,7 @@
local outdir = path.translate(config.gettargetinfo(cfg).directory)
_x(3,'OutputDirectory="%s"', outdir)
- _x(3,'IntermediateDirectory="%s"', path.translate(cfg.objdir))
+ _x(3,'IntermediateDirectory="%s"', path.translate(project.getrelative(cfg.project, cfg.objdir)))
local cfgtype
if (cfg.kind == "SharedLib") then
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index d2bed6fa..df78f856 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -190,7 +190,7 @@
_x(2,'$(OutDir)%s', target.name)
end
- _x(2,'%s\\', path.translate(cfg.objdir))
+ _x(2,'%s\\', path.translate(project.getrelative(cfg.project, cfg.objdir)))
_x(2,'%s%s', target.prefix, target.basename)
_x(2,'%s', target.extension)
diff --git a/src/base/solution.lua b/src/base/solution.lua
index 8f38ab53..7f0e33c5 100644
--- a/src/base/solution.lua
+++ b/src/base/solution.lua
@@ -187,7 +187,7 @@
for cfg, dirs in pairs(configs) do
for _, dir in ipairs(dirs) do
if counts[dir] == 1 then
- cfg.objdir = project.getrelative(cfg.project, dir)
+ cfg.objdir = dir
break
end
end
diff --git a/tests/solution/test_objdirs.lua b/tests/solution/test_objdirs.lua
index a46de030..51494b7b 100644
--- a/tests/solution/test_objdirs.lua
+++ b/tests/solution/test_objdirs.lua
@@ -20,11 +20,12 @@
system "macosx"
end
- local function prepare()
+ local function result()
local platforms = sln.platforms or {}
project("MyProject")
prj = premake.solution.getproject_ng(sln, "MyProject")
cfg = premake5.project.getconfig(prj, "Debug", platforms[1])
+ return premake5.project.getrelative(prj, cfg.objdir)
end
@@ -34,8 +35,7 @@
function suite.directoryIsObj_onNoValueSet()
configurations { "Debug" }
- prepare()
- test.isequal("obj", cfg.objdir)
+ test.isequal("obj", result())
end
@@ -47,8 +47,7 @@
function suite.directoryIncludesPlatform_onPlatformConflict()
configurations { "Debug" }
platforms { "x32", "x64" }
- prepare()
- test.isequal("obj/x32", cfg.objdir)
+ test.isequal("obj/x32", result())
end
@@ -59,8 +58,7 @@
function suite.directoryIncludesBuildCfg_onBuildCfgConflict()
configurations { "Debug", "Release" }
- prepare()
- test.isequal("obj/Debug", cfg.objdir)
+ test.isequal("obj/Debug", result())
end
@@ -72,8 +70,7 @@
function suite.directoryIncludesBuildCfg_onPlatformAndBuildCfgConflict()
configurations { "Debug", "Release" }
platforms { "x32", "x64" }
- prepare()
- test.isequal("obj/x32/Debug", cfg.objdir)
+ test.isequal("obj/x32/Debug", result())
end
@@ -85,7 +82,6 @@
function suite.directoryIncludesBuildCfg_onProjectConflict()
configurations { "Debug", "Release" }
project "MyProject2"
- prepare()
- test.isequal("obj/Debug/MyProject", cfg.objdir)
+ test.isequal("obj/Debug/MyProject", result())
end