summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-01-30 00:33:55 +0800
committerruki <[email protected]>2019-01-29 21:23:31 +0800
commit41692173a4b81050d0e521036d6d88b674db98ef (patch)
tree55b42b4c422e1d9ae7b0e83df06a399a72ca2f4d
parent0bfe3e42e041fb23bf15669c4c88931a4bc65c48 (diff)
fix find_package bug
-rw-r--r--xmake/core/package/package.lua2
-rw-r--r--xmake/modules/lib/detect/pkg_config.lua1
-rw-r--r--xmake/modules/package/manager/vcpkg/find_package.lua3
3 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 6c9bb0f92..12c1e97cc 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -596,6 +596,7 @@ function _instance:fetch(opt)
mode = self:mode(),
islocal = self:from("local"),
version = require_ver,
+ cachekey = "fetch_package_xmake",
configs_hash = self:configs_hash(),
force = opt.force or self:from("local")})
if fetchinfo then fetchfrom = self._FROMKIND end
@@ -606,6 +607,7 @@ function _instance:fetch(opt)
fetchinfo = self._find_package(self:name(), {force = opt.force,
version = require_ver,
mode = self:mode(),
+ cachekey = "fetch_package_system",
system = true})
if fetchinfo then fetchfrom = "system" end
end
diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua
index 79d772b84..4f1eaedac 100644
--- a/xmake/modules/lib/detect/pkg_config.lua
+++ b/xmake/modules/lib/detect/pkg_config.lua
@@ -63,6 +63,7 @@ function info(name, opt)
end
-- get libs and cflags
+ local result = nil
local flags = try { function () return os.iorunv(pkg_config, {"--libs", "--cflags", name}) end }
if flags then
diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua
index 9fd8d8c59..37d97e7c0 100644
--- a/xmake/modules/package/manager/vcpkg/find_package.lua
+++ b/xmake/modules/package/manager/vcpkg/find_package.lua
@@ -63,6 +63,7 @@ function main(name, opt)
local infofile = find_file(format("%s_*_%s-%s.list", name, arch, plat), infodir)
-- save includedirs, linkdirs and links
+ local result = nil
local info = infofile and io.readfile(infofile) or nil
if info then
for _, line in ipairs(info:split('\n')) do
@@ -89,7 +90,7 @@ function main(name, opt)
end
-- save version
- if result then
+ if result and infofile then
local infoname = path.basename(infofile)
result.version = infoname:match(name .. "_(%d+%.?%d*%.?%d*.-)_" .. arch)
if not result.version then