From c780bba3ebc6cea5386b15ec4744e66bb9fb3263 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 21 Apr 2025 22:56:26 +0800 Subject: fix detect -fmodule-header for gcc --- xmake/rules/c++/modules/gcc/support.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xmake/rules/c++/modules/gcc/support.lua b/xmake/rules/c++/modules/gcc/support.lua index 264195874..52d8af79f 100644 --- a/xmake/rules/c++/modules/gcc/support.lua +++ b/xmake/rules/c++/modules/gcc/support.lua @@ -208,8 +208,11 @@ end function get_moduleheaderflag(target) local moduleheaderflag = _g.moduleheaderflag if moduleheaderflag == nil then + -- we need to suppress warnings/errors: + -- external linkage definition of 'int main(int, char**)' in header module must be declared 'inline' + local snippet = "" local compinst = target:compiler("cxx") - if compinst:has_flags("-fmodule-header", "cxxflags", {flagskey = "gcc_module_header"}) then + if compinst:has_flags("-fmodule-header", "cxxflags", {snippet = snippet, flagskey = "gcc_module_header"}) then moduleheaderflag = "-fmodule-header=" end _g.moduleheaderflag = moduleheaderflag or false -- cgit v1.3.1