From 28b489004ecd6100a36060dfc4b116ff554c44e2 Mon Sep 17 00:00:00 2001 From: KageKirin Date: Tue, 10 Dec 2019 18:10:23 +0900 Subject: [PATCH] Add premake.projectdoeslink() to check if a project actually has something to link --- src/base/project.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/base/project.lua b/src/base/project.lua index 787f3856..7b92bc79 100644 --- a/src/base/project.lua +++ b/src/base/project.lua @@ -393,6 +393,23 @@ end +-- +-- Checks if the project has something to link +-- + + function premake.projectdoeslink(prj, cfgname, platform) + local prjcfg = premake.getconfig(prj, cfgname, platform) + local lnkobj = table.icontains(table.translate(prjcfg.files, path.issourcefile), true) + local lnkdep = false + if prj.kind ~= 'StaticLib' then + lnkdep = table.icontains(table.translate(prjcfg.links, function(lnk) + local link = premake.findproject(lnk) + return premake.projectdoeslink(link, cfgname, platform) + end), true) + end + return lnkobj or lnkdep + end + -- -- Gets the name style for a configuration, indicating what kind of prefix,