summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-02-28 23:57:05 +0800
committerruki <[email protected]>2024-02-28 23:57:05 +0800
commit5469bf4da989e804f5bae0f4f6d5b93adbd5e2f4 (patch)
treef784acae05a987d2056815f66fdbc07adad0af3b /xmake/modules/private/utils/batchcmds.lua
parentc69fc2618424e029e7eef1f597362232c2a69a09 (diff)
fix batchcmds:compilev
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 4fa2514c9..feba05b3c 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -284,14 +284,16 @@ function batchcmds:compilev(argv, opt)
end
-- we need to translate path for the project generator
+ local patterns = {"(^[%-/]external:I)(.*)", "(^[%-/]I)(.*)", "(^[%-/]Fp)(.*)", "(^[%-/]Fd)(.*)"}
for idx, item in ipairs(argv) do
if type(item) == "string" then
- if item:startswith("-I") then
- argv[idx] = path(item:sub(3), function (p) return "-I" .. p end)
- elseif item:startswith("/I") then
- argv[idx] = path(item:sub(3), function (p) return "/I" .. p end)
- elseif item:startswith("-external:I") or item:startswith("/external:I") then
- argv[idx] = path(item:sub(12), function (p) return "-external:I" .. p end)
+ for _, pattern in ipairs(patterns) do
+ local _, count = item:gsub(pattern, function (prefix, value)
+ argv[idx] = path(value, function (p) return prefix .. p end)
+ end)
+ if count > 0 then
+ break
+ end
end
end
end