summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-15 23:32:43 +0800
committerruki <[email protected]>2021-02-15 23:32:43 +0800
commit539d59c61df9b1f42b0c5ad0dc15ae40c8cff1d4 (patch)
tree6fc19f127f1871e1dfdea592b9520aea52cee9e7
parent42d99536a773f453720698cb791c95361fba8b9e (diff)
improve find library
-rw-r--r--xmake/core/project/target.lua4
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_library.lua6
2 files changed, 5 insertions, 5 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 1f0cf5232..c0a643434 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1901,8 +1901,8 @@ function target.linkname(filename)
if count == 0 then
linkname, count = filename:gsub(target.filename("__pattern__", "shared"):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1")
end
- if count == 0 and config.is_plat("mingw") then
- -- for the mingw platform, it is compatible with the libxxx.a and xxx.lib
+ if count == 0 then
+ -- for the mingw/cross platform, it is compatible with the libxxx.a and xxx.lib
local formats = {static = "lib$(name).a", shared = "lib$(name).so"}
linkname, count = filename:gsub(target.filename("__pattern__", "static", {format = formats["static"]}):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1")
if count == 0 then
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_library.lua b/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
index bad638548..bfb2315a5 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
@@ -58,14 +58,14 @@ function sandbox_lib_detect_find_library.main(names, paths, opt)
opt = opt or {}
-- init kinds
- kinds = opt.kind or {"static", "shared"}
+ local kinds = opt.kind or {"static", "shared"}
-- find library file from the given paths
for _, name in ipairs(table.wrap(names)) do
for _, kind in ipairs(table.wrap(kinds)) do
local filepath = find_file(target.filename(name, kind), paths, opt)
- if not filepath and config.is_plat("mingw") then
- -- for the mingw platform, it is compatible with the libxxx.a and xxx.lib
+ if not filepath then
+ -- for the mingw/cross platform, it is compatible with the libxxx.a and xxx.lib
local formats = {static = "lib$(name).a", shared = "lib$(name).so"}
filepath = find_file(target.filename(name, kind, {format = formats[kind]}), paths, opt)
end