From e93186c447c9ae9b2bd05c57a0e85b9c1beb8666 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 29 Mar 2024 22:45:49 +0800 Subject: improve rc deps #4893 --- xmake/modules/core/tools/rc.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua index 55146ee76..7728e2e20 100644 --- a/xmake/modules/core/tools/rc.lua +++ b/xmake/modules/core/tools/rc.lua @@ -128,7 +128,13 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) if cl then local outfile = os.tmpfile() .. ".rc.out" local errfile = os.tmpfile() .. ".rc.err" - local ok = try {function () os.execv(cl, {"-E", sourcefile}, {stdout = outfile, stderr = errfile, envs = self:runenvs()}); return true end} + local includeflags = {} + for _, flag in ipairs(flags) do + if flag:match("^[-/]I") then + table.insert(includeflags, flag) + end + end + local ok = try {function () os.execv(cl, table.join("-E", includeflags, sourcefile), {stdout = outfile, stderr = errfile, envs = self:runenvs()}); return true end} if ok and os.isfile(outfile) then local depfiles_rc local includeset = hashset.new() -- cgit v1.3.1