diff options
| author | ruki <[email protected]> | 2021-01-13 22:38:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-01-13 22:38:21 +0800 |
| commit | dc5ca1d6899eae23268dfac0b7ead5051a788aae (patch) | |
| tree | d74a7bd26a7a9d44c0c778ddab1d776633b9b3cf | |
| parent | 9eca92ce0882344be8d945847643a3a5a4f066de (diff) | |
fix parse_deps for gnrm/gcc
| -rw-r--r-- | xmake/modules/private/tools/gcc/parse_deps.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/modules/private/tools/gcc/parse_deps.lua b/xmake/modules/private/tools/gcc/parse_deps.lua index 0cb2ad4af..cb06d091c 100644 --- a/xmake/modules/private/tools/gcc/parse_deps.lua +++ b/xmake/modules/private/tools/gcc/parse_deps.lua @@ -60,10 +60,16 @@ function main(depsdata) local results = hashset.new() local projectdir = os.projectdir() local line = depsdata:rtrim() -- maybe there will be an empty newline at the end. so we trim it first - line = line:gsub("\\ ", space_placeholder) - for _, includefile in ipairs(line:split(' ', {plain = true})) do -- it will trim all internal spaces without `{strict = true}` + local plain = {plain = true} + line = line:replace("\\ ", space_placeholder, plain) + for _, includefile in ipairs(line:split(' ', plain)) do -- it will trim all internal spaces without `{strict = true}` + -- some gcc toolchains will some invalid paths (e.g. `d\:\xxx`), we need fix it + -- https://github.com/xmake-io/xmake/issues/1196 + if is_host("windows") and includefile:match("^%w\\:") then + includefile = includefile:replace("\\:", ":", plain) + end if not includefile:endswith(":") then -- ignore "xxx.o:" prefix - includefile = includefile:gsub(space_placeholder, ' ') + includefile = includefile:replace(space_placeholder, ' ', plain) if #includefile > 0 then includefile = _normailize_dep(includefile, projectdir) if includefile then |
