Skip to content

Commit

Permalink
fix batchcmds:compilev
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Feb 28, 2024
1 parent c69fc26 commit 5469bf4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions xmake/modules/private/utils/batchcmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5469bf4

Please sign in to comment.