summaryrefslogtreecommitdiff
path: root/xmake/modules/package/manager
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-11 22:47:44 +0800
committerruki <[email protected]>2019-08-11 22:49:06 +0800
commit7204438408a9cd31209af408d911ea45cdcb080e (patch)
tree482e739cbed1ce9b2c3a17b9d8b4c3449f1281e1 /xmake/modules/package/manager
parent5488ec859886b483dd6cfdf624d9deb58471f1a7 (diff)
improve find_package for pkg-config
Diffstat (limited to 'xmake/modules/package/manager')
-rw-r--r--xmake/modules/package/manager/brew/find_package.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/brew/find_package.lua b/xmake/modules/package/manager/brew/find_package.lua
index 5eb2beba3..0a2648eb7 100644
--- a/xmake/modules/package/manager/brew/find_package.lua
+++ b/xmake/modules/package/manager/brew/find_package.lua
@@ -21,6 +21,7 @@
-- imports
import("lib.detect.find_tool")
import("lib.detect.find_file")
+import("lib.detect.pkg_config")
import("package.manager.find_package")
-- find package from the brew package manager
@@ -50,6 +51,14 @@ function main(name, opt)
if pcfile then
opt.configdirs = path.directory(pcfile)
result = find_package("pkg_config::" .. pcname, opt)
+ if not result then
+ -- attempt to get includedir variable from pkg-config/xx.pc
+ local pkginfo = pkg_config.info(pcname, table.join(opt, {variables = "includedir"}))
+ if pkginfo.includedir then
+ result = result or {}
+ result.includedirs = pkginfo.includedir
+ end
+ end
end
-- find package from xxx/lib, xxx/include