Skip to content

Commit 427a390

Browse files
author
Tom van Dijck
committed
add warning about linkdependencies/links in static libraries.
1 parent 9acbc22 commit 427a390

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packageresolver.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ local import_filter = {}
159159
end
160160

161161
local function recursiveLinkDependencies(ctx, deps)
162-
for name,value in sortedpairs(deps) do
162+
for name, value in sortedpairs(deps) do
163163
local filter = nil
164164
if type(value) == 'table' then
165165
filter = __createFilter(value)
@@ -209,8 +209,18 @@ local import_filter = {}
209209
end
210210
end
211211

212+
-- we don't want static libs with links.
213+
if ctx.links and next(ctx.links) and ctx.kind == p.STATICLIB then
214+
local prjname = iif(ctx.project, ctx.project.name, ctx.name)
215+
p.warnOnce(prjname..'l', "The project '" .. prjname .. "' is a static library, but uses 'links', for buildorder use 'dependson'.")
216+
end
217+
212218
-- resolve package links.
213-
if ctx.linkdependencies then
219+
if ctx.linkdependencies and next(ctx.linkdependencies) then
220+
if ctx.kind == p.STATICLIB then
221+
local prjname = iif(ctx.project, ctx.project.name, ctx.name)
222+
p.warnOnce(prjname..'d', "The project '" .. prjname .. "' is a static library, but uses 'use/linkdependencies'.")
223+
end
214224
recursiveLinkDependencies(ctx, ctx.linkdependencies)
215225
end
216226

0 commit comments

Comments
 (0)