summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-19 23:52:44 +0800
committerruki <[email protected]>2018-09-19 17:16:24 +0800
commitbc71d4f29362e0af30fb7446d1d71059acf4ba5b (patch)
tree18bc8051dfe2fffb0bd7e1491774911fc075016e /xmake/core/package/package.lua
parentec49cc61a1b0c14319c63457e4d46ec7134afa8a (diff)
improve find_package for system
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 918db45b3..a07bfb375 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -425,23 +425,22 @@ function _instance:fetch(opt)
-- import find_package
self._find_package = self._find_package or sandbox_module.import("lib.detect.find_package", {anonymous = true})
+ -- nil: find local or system packages
+ -- true: only find system package
+ -- false: only find local packages
+ local system = opt.system or self:requireinfo().system
+
-- fetch it from the prefix directories first
- if not fetchinfo then
+ if not fetchinfo and system ~= true then
-- add cache key to make a distinction with finding system package
fetchinfo = self._find_package(self:name(), {prefixdirs = self:prefixdir(), system = false, cachekey = "package:fetch", force = opt.force})
if fetchinfo then fetchfrom = self._FROMKIND end
end
-- fetch it from the system directories
- if not fetchinfo then
- local system = opt.system or self:requireinfo().system
- if system == nil then -- find system package by default
- system = true
- end
- if system then
- fetchinfo = self._find_package(self:name(), {force = opt.force})
- if fetchinfo then fetchfrom = "system" end
- end
+ if not fetchinfo and system ~= false then
+ fetchinfo = self._find_package(self:name(), {force = opt.force, system = true})
+ if fetchinfo then fetchfrom = "system" end
end
end