Fix relative paths to target dependencies

This commit is contained in:
starkos 2008-11-21 16:49:00 +00:00
parent 63a2f3fe60
commit 1bd66554bd
3 changed files with 14 additions and 5 deletions

View File

@ -36,6 +36,7 @@
for _, prj in ipairs(deps) do
local prjcfg = premake.getconfig(prj, cfg.name)
local target = premake.gettargetfile(prjcfg, "target", prjcfg.kind, iif(prjcfg.kind == "StaticLib", "linux", nil))
target = path.rebase(target, prjcfg.location, cfg.location)
table.insert(result, _MAKE.esc(target))
end
return result

View File

@ -170,11 +170,7 @@
target = prjcfg.target
end
-- target is currently relative to its project location, make
-- it relative to my location instead
target = path.getabsolute(path.join(prjcfg.location, target))
target = path.getrelative(cfg.location, target)
target = path.rebase(target, prjcfg.location, cfg.location)
table.insert(libs, target)
else
if (range ~= "siblings") then

View File

@ -97,6 +97,18 @@
end
--
-- Takes a path which is relative to one location and makes it relative
-- to another location instead.
--
function path.rebase(p, oldbase, newbase)
p = path.getabsolute(path.join(oldbase, p))
p = path.getrelative(newbase, p)
return p
end
--
-- Returns the relative path from src to dest.
--