summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-19 23:37:56 +0800
committerruki <[email protected]>2018-09-19 15:47:37 +0800
commit5b8f5935928e420cbfe31cd31586f3132a266c63 (patch)
treead7cec371c7fffd76f5d0830004b7661620988cc
parent2e6bc9480e3255e6816b647a56e50f4a88f0df31 (diff)
improve find_pacakge
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_package.lua27
1 files changed, 5 insertions, 22 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua
index 36ef8e1c2..089f65132 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua
@@ -139,16 +139,16 @@ function sandbox_lib_detect_find_package._find_from_prefixdirs(name, opt)
-- get prefix directories
local prefixdirs = table.wrap(opt.prefixdirs)
if #prefixdirs == 0 then
- table.insert(prefixdirs, path.join(global.directory(), "prefix", "release", config.get("plat") or os.host(), config.get("arch") or os.arch()))
table.insert(prefixdirs, path.join(config.directory(), "prefix", "release", config.get("plat") or os.host(), config.get("arch") or os.arch()))
+ table.insert(prefixdirs, path.join(global.directory(), "prefix", "release", config.get("plat") or os.host(), config.get("arch") or os.arch()))
end
-- find the package list file, .e.g zlib-1.2.11.txt
local prefixfile = find_file(name .. "-*.txt", prefixdirs, {suffixes = ".list"})
-- get the include and link directories
- local linkdirs = table.wrap(opt.linkdirs)
- local includedirs = table.wrap(opt.includedirs)
+ local linkdirs = {}
+ local includedirs = {}
if prefixfile then
local prefixdir = path.directory(path.directory(prefixfile))
table.insert(linkdirs, path.join(prefixdir, "lib"))
@@ -194,8 +194,7 @@ function sandbox_lib_detect_find_package._find_from_prefixdirs(name, opt)
links = table.wrap(name)
end
- -- import find_path and find_library
- local find_path = import("lib.detect.find_path")
+ -- import find_library
local find_library = import("lib.detect.find_library")
-- find library
@@ -210,23 +209,7 @@ function sandbox_lib_detect_find_package._find_from_prefixdirs(name, opt)
end
if result and result.links then
result.links = table.unique(result.links)
- end
-
- -- find includes
- for _, include in ipairs(table.wrap(opt.includes)) do
- local includedir = find_path(include, includedirs)
- if includedir then
- result = result or {}
- result.includedirs = table.join(result.includedirs or {}, includedir)
- end
- end
- for _, include in ipairs({name .. "/" .. name .. ".h", name .. ".h"}) do
- local includedir = find_path(include, includedirs)
- if includedir then
- result = result or {}
- result.includedirs = table.join(result.includedirs or {}, includedir)
- break
- end
+ result.includedirs = includedirs
end
-- save version