summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-12 00:59:45 +0800
committerruki <[email protected]>2020-11-12 00:59:45 +0800
commit16178e3b8cc9331c505a5194d89acec4d0f0a801 (patch)
treec3ec46fcc516027182bc4f5ac0a671e134596042
parent8720d7ba6d82aacd3b6953596ef2687c3368120e (diff)
improve pacman/find_package
-rw-r--r--xmake/modules/package/manager/pacman/find_package.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/pacman/find_package.lua b/xmake/modules/package/manager/pacman/find_package.lua
index 8c2f4ccd7..52ef8bf9e 100644
--- a/xmake/modules/package/manager/pacman/find_package.lua
+++ b/xmake/modules/package/manager/pacman/find_package.lua
@@ -54,6 +54,7 @@ function main(name, opt)
local pkgconfig_dir = nil
local pkgconfig_name = nil
local linkdirs = {}
+ local has_includes = false
for _, line in ipairs(list:split('\n', {plain = true})) do
line = line:trim():split('%s+')[2]
if not pkgconfig_dir and line:find("/pkgconfig/", 1, true) and line:endswith(".pc") then
@@ -62,6 +63,8 @@ function main(name, opt)
end
if line:endswith(".so") or line:endswith(".a") or line:endswith(".lib") then
table.insert(linkdirs, path.directory(line))
+ elseif line:find("/include/", 1, true) and (line:endswith(".h") or line:endswith(".hpp")) then
+ has_includes = true
end
end
@@ -69,7 +72,12 @@ function main(name, opt)
local result = nil
if pkgconfig_dir then
linkdirs = table.unique(linkdirs)
+ includedirs = table.unique(includedirs)
result = find_package_from_pkgconfig(pkgconfig_name or name, {configdirs = pkgconfig_dir, linkdirs = linkdirs})
+ if not result and has_includes then
+ -- header only and hidden /usr/include? we need only return empty {}
+ result = {}
+ end
end
return result
end