From e96c3155ee33cdba5bd83f756d1134c55e4c9fa8 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 5 Sep 2024 22:48:39 +0800 Subject: improve to get link name --- xmake/core/project/target.lua | 9 +++++++-- 1 file 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 -- cgit v1.3.1