summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect/find_tool.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-17 23:24:16 +0800
committerruki <[email protected]>2017-07-17 23:24:34 +0800
commit7cac00bb9cace801c6db9758d2a01d2711738926 (patch)
tree40831686913090534c1e2b5ddb54399aa5b6bf11 /xmake/modules/lib/detect/find_tool.lua
parent33144e73eae59ee7d934fd77673aac5a5a5cb0d1 (diff)
add add_moduledirs api and improve import
Diffstat (limited to 'xmake/modules/lib/detect/find_tool.lua')
-rw-r--r--xmake/modules/lib/detect/find_tool.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/xmake/modules/lib/detect/find_tool.lua b/xmake/modules/lib/detect/find_tool.lua
index 58289b0dc..6d74a7804 100644
--- a/xmake/modules/lib/detect/find_tool.lua
+++ b/xmake/modules/lib/detect/find_tool.lua
@@ -30,13 +30,11 @@ import("lib.detect.find_toolname")
-- find tool from modules
function _find_from_modules(name, opt)
- -- "detect.tools.find_xxx" exists?
- if os.isfile(path.join(os.programdir(), "modules", "detect", "tools", "find_" .. name .. ".lua")) then
- local find_tool = import("detect.tools.find_" .. name)
- if find_tool then
- local program, version, toolname = find_tool(opt)
- return {name = toolname or name, program = program, version = version}
- end
+ -- attempt to import "detect.tools.find_xxx"
+ local find_tool = import("detect.tools.find_" .. name, {try = true})
+ if find_tool then
+ local program, version, toolname = find_tool(opt)
+ return {name = toolname or name, program = program, version = version}
end
end