From 18f193ed0b7da9eaa2d62794de30a0a923776616 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 12 Sep 2018 23:56:41 +0800 Subject: improve to install package --- xmake/core/project/target.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xmake/core/project/target.lua') diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 9e48ec3c2..b35c80ae4 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -132,6 +132,15 @@ function target.filename(targetname, targetkind, targetformat) return format and (format:gsub("%$%(name%)", targetname)) or targetname end +-- get the link name of the target file +function target.linkname(filename) + local linkname, count = filename:gsub(target.filename("__pattern__", "static"):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1") + if count == 0 then + linkname, count = filename:gsub(target.filename("__pattern__", "shared"):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1") + end + return count > 0 and linkname or nil +end + -- new a target instance function target.new(name, info, project) -- cgit v1.3.1