summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-12 23:56:41 +0800
committerruki <[email protected]>2018-09-12 17:40:08 +0800
commit18f193ed0b7da9eaa2d62794de30a0a923776616 (patch)
treee5fae313fb889da96a2fb562e716ebec6c61f226 /xmake/core/project/target.lua
parentd5bbf65a46f53058816081631fafc015bce83ba3 (diff)
improve to install package
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua9
1 files changed, 9 insertions, 0 deletions
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)