summaryrefslogtreecommitdiff
path: root/xmake/core/project
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/project')
-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)