summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-19 00:40:53 +0800
committerruki <[email protected]>2022-05-19 00:40:53 +0800
commitd3b2139aacaf4efba9f47e16f36d6086f9e5544b (patch)
tree7f52fa0e4dc297cbb7cf76999bbe777a1b6a050b /xmake/modules/core/tools/gcc.lua
parent05eff25304b1a440b481fc71ec2dcb082be98e4f (diff)
ignore pch for preprocess
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 6a6f5fadd..5c1a3f132 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -401,7 +401,7 @@ function _preprocess(program, argv, opt)
table.insert(cppflags, flag)
-- get compiler flags
- if flag == "-MMD" or flag:startswith("-I") or flag:startswith("--sysroot=") then
+ if flag == "-MMD" or (flag:startswith("-I") and #flag > 2) or flag:startswith("--sysroot=") then
skipped = 1
elseif flag == "-MF" or
flag == "-I" or flag == "-isystem" or flag == "-include" or flag == "-include-pch" or
@@ -420,6 +420,11 @@ function _preprocess(program, argv, opt)
local sourcefile = argv[#argv]
assert(objectfile and sourcefile, "%s: iorunv(%s): invalid arguments!", self, program)
+ -- is precompiled header?
+ if objectfile:endswith(".gch") or objectfile:endswith(".pch") then
+ return false
+ end
+
-- do preprocess
local cppfile = path.join(path.directory(objectfile), path.basename(objectfile) .. path.extension(sourcefile))
local cppfiledir = path.directory(cppfile)