summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-05-27 22:46:01 +0800
committerruki <[email protected]>2026-07-08 22:17:00 +0800
commit6133f843f898f3be4181a10bfa4ce5b310e44804 (patch)
tree269798317333cb9ce74b326ad1c759307d8ae3b7
parent344a31af1c92d0f9f249cbe6a9e7cb3ca933deb4 (diff)
fix pch for std modules
-rw-r--r--xmake/modules/core/tools/gcc.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 9172dd2ed..1119cd123 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -971,11 +971,13 @@ function compargv(self, sourcefile, objectfile, flags, opt)
opt = opt or {}
-- is precompiled header or module files? remove the force includes.
+ -- @see https://github.com/xmake-io/xmake/issues/7560
local extension = path.extension(sourcefile)
if toolchain_utils.is_cxx_headerext(extension) then
flags = _translate_flags_for_pch(self, flags)
elseif support.has_module_extension(sourcefile, {extension = extension})
- or support.is_stdmodule_file(opt.target, sourcefile) then
+ or (opt.target and support.contains_modules(opt.target)
+ and support.is_stdmodule_file(opt.target, sourcefile)) then
flags = _translate_flags_for_mpp(self, flags)
end