summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-05 22:48:39 +0800
committerruki <[email protected]>2024-09-05 22:48:39 +0800
commite96c3155ee33cdba5bd83f756d1134c55e4c9fa8 (patch)
treeb1f73e3ebfe0324fe3338cb52b64e50dae83771e
parent6926dc82b90ee05088694821aa5e829d25d8a3b4 (diff)
improve to get link name
-rw-r--r--xmake/core/project/target.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index ace54441c..4ca895d0c 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2947,8 +2947,13 @@ function target.linkname(filename, opt)
if count > 0 and linkname then
return linkname
end
- -- for custom shared libraries name, xxx.so, xxx.dylib
- if not filename:startswith("lib") and (filename:endswith(".so") or filename:endswith(".dylib")) then
+ -- fallback to the generic unix library name, libxxx.a, libxxx.so, ..
+ if filename:startswith("lib") then
+ if filename:endswith(".a") or filename:endswith(".so") then
+ return path.basename(filename:sub(4))
+ end
+ elseif filename:endswith(".so") or filename:endswith(".dylib") then
+ -- for custom shared libraries name, xxx.so, xxx.dylib
return filename
end
return nil