summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-07-17 22:39:09 +0800
committerruki <[email protected]>2023-07-17 22:39:09 +0800
commitdb41e5b8e4fc20027a4fdfd1b0bbe9985ee5ffb2 (patch)
tree5261a244856bdad066a62f564affa465d232e8eb
parent226883c04664809344db3c7f3111cec497ec76c8 (diff)
fix set_pmheader
-rw-r--r--tests/projects/objc++/precompiled_header/xmake.lua2
-rw-r--r--xmake/modules/core/tools/gcc.lua8
2 files changed, 8 insertions, 2 deletions
diff --git a/tests/projects/objc++/precompiled_header/xmake.lua b/tests/projects/objc++/precompiled_header/xmake.lua
index 55382962d..5251ab04c 100644
--- a/tests/projects/objc++/precompiled_header/xmake.lua
+++ b/tests/projects/objc++/precompiled_header/xmake.lua
@@ -3,6 +3,6 @@ add_rules("mode.debug", "mode.release")
target("main")
set_kind("binary")
set_languages("cxx11")
- set_pmxxheader("src/header.h")
+ set_pmheader("src/header.h")
add_files("src/*.mm", "src/*.c", "*.mm")
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 35b296ef0..cfd5fac5c 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -651,13 +651,19 @@ function _compargv_pch(self, pcheaderfile, pcoutputfile, flags)
end
end
- -- compile header.h as c++?
+ -- set the language of precompiled header?
if self:kind() == "cxx" then
table.insert(pchflags, "-x")
table.insert(pchflags, "c++-header")
+ elseif self:kind() == "cc" then
+ table.insert(pchflags, "-x")
+ table.insert(pchflags, "c-header")
elseif self:kind() == "mxx" then
table.insert(pchflags, "-x")
table.insert(pchflags, "objective-c++-header")
+ elseif self:kind() == "mm" then
+ table.insert(pchflags, "-x")
+ table.insert(pchflags, "objective-c-header")
end
-- make the compile arguments list