Strip linking decorators for sibling projects
- Added unit tests for linking decorators
This commit is contained in:
parent
261b627f54
commit
d95cd28337
@ -262,10 +262,20 @@
|
|||||||
local link = cfg.links[i]
|
local link = cfg.links[i]
|
||||||
local item
|
local item
|
||||||
|
|
||||||
|
-- Strip linking decorators from link, to determine if the link
|
||||||
|
-- is a "sibling" project.
|
||||||
|
local endswith = function(s, ptrn)
|
||||||
|
return ptrn == string.sub(s, -string.len(ptrn))
|
||||||
|
end
|
||||||
|
local name = link
|
||||||
|
if endswith(name, ":static") or endswith(name, ":shared") then
|
||||||
|
name = string.sub(name, 0, -8)
|
||||||
|
end
|
||||||
|
|
||||||
-- Sort the links into "sibling" (is another project in this same
|
-- Sort the links into "sibling" (is another project in this same
|
||||||
-- workspace) and "system" (is not part of this workspace) libraries.
|
-- workspace) and "system" (is not part of this workspace) libraries.
|
||||||
|
|
||||||
local prj = p.workspace.findproject(cfg.workspace, link)
|
local prj = p.workspace.findproject(cfg.workspace, name)
|
||||||
if prj and kind ~= "system" then
|
if prj and kind ~= "system" then
|
||||||
|
|
||||||
-- Sibling; is there a matching configuration in this project that
|
-- Sibling; is there a matching configuration in this project that
|
||||||
|
@ -222,3 +222,45 @@
|
|||||||
local r = prepare("all", "fullpath")
|
local r = prepare("all", "fullpath")
|
||||||
test.isequal({ "bin/Debug/MyProject2.lib" }, r)
|
test.isequal({ "bin/Debug/MyProject2.lib" }, r)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Linking decorators need to be passed through
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.canLink_StaticDecoratorSystemLib()
|
||||||
|
links { "SystemLibrary:static" }
|
||||||
|
local r = prepare("all", "fullpath")
|
||||||
|
test.isequal({ "SystemLibrary:static" }, r)
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.canLink_SharedDecoratorSystemLib()
|
||||||
|
links { "SystemLibrary:shared" }
|
||||||
|
local r = prepare("all", "fullpath")
|
||||||
|
test.isequal({ "SystemLibrary:shared" }, r)
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Linking decorators need to be stripped for sibling projects
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.canLink_StaticDecoratorSiblingLib()
|
||||||
|
links { "SiblingLibrary:static" }
|
||||||
|
|
||||||
|
project "SiblingLibrary"
|
||||||
|
kind "StaticLib"
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
local r = prepare("all", "fullpath")
|
||||||
|
test.isequal({ "bin/Debug/SiblingLibrary.lib" }, r)
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.canLink_SharedDecoratorSiblingLib()
|
||||||
|
links { "SiblingLibrary:shared" }
|
||||||
|
|
||||||
|
project "SiblingLibrary"
|
||||||
|
kind "SharedLib"
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
local r = prepare("all", "fullpath")
|
||||||
|
test.isequal({ "bin/Debug/SiblingLibrary.lib" }, r)
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user