summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/cl.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-30 00:44:34 +0800
committerruki <[email protected]>2022-09-30 00:44:34 +0800
commitba447a112b54a97fc9f94fbb5be407caa68032a9 (patch)
tree744309ad8307aaf61b647874456a00d043a073b3 /xmake/modules/core/tools/cl.lua
parent7626a266bbefa72be1b1aac79f4c78e3ca48a9ac (diff)
fix pch error with cache #2885
Diffstat (limited to 'xmake/modules/core/tools/cl.lua')
-rw-r--r--xmake/modules/core/tools/cl.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index b05e35eb4..31bdce256 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -413,6 +413,8 @@ function _preprocess(program, argv, opt)
local skipped = 0
local objectfile
local pdbfile
+ local sourcefile = argv[#argv]
+ local extension = path.extension(sourcefile)
for _, flag in ipairs(argv) do
if flag:startswith("-Fo") or flag:startswith("/Fo") then
objectfile = flag:sub(4)
@@ -433,10 +435,13 @@ function _preprocess(program, argv, opt)
-- get compiler flags
if flag == "-showIncludes" or flag == "/showIncludes" or
(flag:startswith("-I") and #flag > 2) or (flag:startswith("/I") and #flag > 2) or
+ flag:startswith("-external:") or flag:startswith("/external:") then
+ skipped = 1
+ -- @note we cannot ignore precompiled flags when compiling pch, @see https://github.com/xmake-io/xmake/issues/2885
+ elseif not extension:startswith(".h") and (
flag:startswith("-Yu") or flag:startswith("/Yu") or
flag:startswith("-FI") or flag:startswith("/FI") or
- flag:startswith("-Fp") or flag:startswith("/Fp") or
- flag:startswith("-external:") or flag:startswith("/external:") then
+ flag:startswith("-Fp") or flag:startswith("/Fp")) then
skipped = 1
elseif flag == "-I" or flag == "-sourceDependencies" or flag == "/sourceDependencies" then
skipped = 2
@@ -450,7 +455,6 @@ function _preprocess(program, argv, opt)
table.insert(flags, flag)
end
end
- local sourcefile = argv[#argv]
assert(objectfile and sourcefile, "%s: iorunv(%s): invalid arguments!", self, program)
-- is precompiled header?