Skip to content

Commit e96c315

Browse files
committed
improve to get link name
1 parent 6926dc8 commit e96c315

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

xmake/core/project/target.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -2947,8 +2947,13 @@ function target.linkname(filename, opt)
29472947
if count > 0 and linkname then
29482948
return linkname
29492949
end
2950-
-- for custom shared libraries name, xxx.so, xxx.dylib
2951-
if not filename:startswith("lib") and (filename:endswith(".so") or filename:endswith(".dylib")) then
2950+
-- fallback to the generic unix library name, libxxx.a, libxxx.so, ..
2951+
if filename:startswith("lib") then
2952+
if filename:endswith(".a") or filename:endswith(".so") then
2953+
return path.basename(filename:sub(4))
2954+
end
2955+
elseif filename:endswith(".so") or filename:endswith(".dylib") then
2956+
-- for custom shared libraries name, xxx.so, xxx.dylib
29522957
return filename
29532958
end
29542959
return nil

0 commit comments

Comments
 (0)