Merge pull request #1975 from LORgames/ssurtees/linkingDecorators

Strip linking decorators for sibling projects
This commit is contained in:
Nick Clark 2022-10-06 22:05:19 -04:00 committed by GitHub
commit 60a89804bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 1 deletions

View File

@ -262,10 +262,20 @@
local link = cfg.links[i]
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
-- 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
-- Sibling; is there a matching configuration in this project that

View File

@ -222,3 +222,45 @@
local r = prepare("all", "fullpath")
test.isequal({ "bin/Debug/MyProject2.lib" }, r)
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