Skip to content

Commit

Permalink
improve to get link name
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Sep 5, 2024
1 parent 6926dc8 commit e96c315
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions xmake/core/project/target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e96c315

Please sign in to comment.