summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-30 10:39:10 +0800
committerGitHub <[email protected]>2021-11-30 10:39:10 +0800
commit5463aadf3a10a0c13d6df3de714a45b422d38df0 (patch)
tree0b6f9752c03a64e735a26d747812649932dae777
parentcfa1ead056d11aef08971bcf9dcb2996d989515a (diff)
Update find_package.lua
-rw-r--r--xmake/modules/package/manager/pacman/find_package.lua24
1 files changed, 7 insertions, 17 deletions
diff --git a/xmake/modules/package/manager/pacman/find_package.lua b/xmake/modules/package/manager/pacman/find_package.lua
index 0f38a92fc..fd936af40 100644
--- a/xmake/modules/package/manager/pacman/find_package.lua
+++ b/xmake/modules/package/manager/pacman/find_package.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.project.target")
import("lib.detect.find_tool")
import("package.manager.pkgconfig.find_package", {alias = "find_package_from_pkgconfig"})
@@ -56,31 +57,20 @@ function _find_package_from_list(list, name, pacman, opt)
-- remove lib and .a, .dll.a and .so to have the links
elseif line:endswith(".dll.a") then -- only for mingw
local apath = os.iorunv(cygpath.program, {"--windows", line})
+ apath = apath:trim()
table.insert(result.linkdirs, path.directory(apath))
- apath = path.filename(apath)
- if apath:startswith("lib") then
- apath = apath:sub(4, apath:len())
- end
- table.insert(result.links, apath:sub(1, apath:len() - 7))
+ table.insert(result.links, target.linkname(path.filename(apath), {plat = opt.plat}))
elseif line:endswith(".so") then
- local apath = line
- table.insert(result.linkdirs, path.directory(apath))
- apath = path.filename(apath)
- if apath:startswith("lib") then
- apath = apath:sub(4, apath:len())
- end
- table.insert(result.links, apath:sub(1, apath:len() - 4))
+ table.insert(result.linkdirs, path.directory(line))
+ table.insert(result.links, target.linkname(path.filename(line), {plat = opt.plat}))
elseif line:endswith(".a") then
local apath = line
if is_subhost("msys") and opt.plat == "mingw" then
apath = os.iorunv(cygpath.program, {"--windows", line})
+ apath = apath:trim()
end
table.insert(result.linkdirs, path.directory(apath))
- apath = path.filename(apath)
- if apath:startswith("lib") then
- apath = apath:sub(4, apath:len())
- end
- table.insert(result.links, apath:sub(1, apath:len() - 3))
+ table.insert(result.links, target.linkname(path.filename(apath), {plat = opt.plat}))
end
end
result.includedirs = table.unique(result.includedirs)