summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect/find_tool.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-16 15:45:31 +0800
committerruki <[email protected]>2017-06-16 15:45:31 +0800
commitb3cc1e1c42d8b367f2d0b1a93c236abe1cc94b34 (patch)
tree206f6249f3f61d856ecbfb731661a2514923a91f /xmake/modules/lib/detect/find_tool.lua
parent4ce04f4a25ac9fa21e19ae4c568d7a253959680a (diff)
replace old find compiler scripts and fix string.endswith
Diffstat (limited to 'xmake/modules/lib/detect/find_tool.lua')
-rw-r--r--xmake/modules/lib/detect/find_tool.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/modules/lib/detect/find_tool.lua b/xmake/modules/lib/detect/find_tool.lua
index 74d446bb4..0911bea20 100644
--- a/xmake/modules/lib/detect/find_tool.lua
+++ b/xmake/modules/lib/detect/find_tool.lua
@@ -29,9 +29,17 @@ import("lib.detect.find_programver")
-- find tool from modules
function _find_from_modules(name, opt)
+ -- strip arguments with spaces
+ name = name:split("%s+")[1]
+
-- replace "+" to "x"
name = name:gsub("%+", "x")
+ -- strip suffix on windows
+ if os.host() == "windows" and name:endswith(".exe") then
+ name = name:sub(1, #name - 4)
+ end
+
-- "detect.tool.find_xxx" exists?
if os.isfile(path.join(os.programdir(), "modules", "detect", "tool", "find_" .. name .. ".lua")) then
local find_tool = import("detect.tool.find_" .. name)