summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-09 00:37:29 +0800
committerruki <[email protected]>2020-09-09 00:37:29 +0800
commitdf0fa920c555f4ffd91558f6b4eb441ce3847e6b (patch)
treeca94558f49ab4cc76bc830e0d904924adbef77bc
parentc7a9ee188852f809ca31d0616f5a5513da846f6a (diff)
improve find_package for pkgconfig
-rw-r--r--xmake/modules/package/manager/pkg_config/find_package.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/pkg_config/find_package.lua b/xmake/modules/package/manager/pkg_config/find_package.lua
index 5ca2d5394..ff1a0cc24 100644
--- a/xmake/modules/package/manager/pkg_config/find_package.lua
+++ b/xmake/modules/package/manager/pkg_config/find_package.lua
@@ -20,6 +20,8 @@
-- imports
import("lib.detect.pkg_config")
+import("lib.detect.find_library")
+import("package.manager.system.find_package", {alias = "find_package_from_system"})
-- find package from the pkg-config package manager
--
@@ -37,6 +39,15 @@ function main(name, opt)
return
end
+ -- no linkdirs in pkg-config? attempt to find it from system directories
+ if libinfo.links and not libinfo.linkdirs then
+ local libinfo_sys = find_package_from_system(name, table.join(opt, {links = libinfo.links}))
+ if libinfo_sys then
+ libinfo.linkdirs = libinfo_sys.linkdirs
+ end
+ end
+
+ -- get result
local result = nil
if libinfo.links or libinfo.includedirs then
result = result or {}