summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-04-25 22:47:34 +0800
committerruki <[email protected]>2019-04-25 10:45:28 +0800
commitbef83839894c841a4423f7724abd4495ea7b3c75 (patch)
tree28732fd28d0c68f136d54ffc9216890c3569edd3 /xmake/core/project/target.lua
parent64a34fcca6999e1e0478d77d86801a8bf5fbff21 (diff)
improve find_library for mingw
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 0ad6b533e..cebbfec7d 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1605,6 +1605,14 @@ 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
+ local formats = {static = "lib$(name).a", shared = "lib$(name).so"}
+ linkname, count = filename:gsub(target.filename("__pattern__", "static", formats["static"]):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1")
+ if count == 0 then
+ linkname, count = filename:gsub(target.filename("__pattern__", "shared", formats["shared"]):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1")
+ end
+ end
return count > 0 and linkname or nil
end