summaryrefslogtreecommitdiff
path: root/xmake/modules/core
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/core')
-rw-r--r--xmake/modules/core/tools/cl.lua14
-rw-r--r--xmake/modules/core/tools/gcc.lua14
2 files changed, 8 insertions, 20 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 44e696f4b..7b0e81be0 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -281,16 +281,10 @@ function nf_includedir(self, dir)
return {"-I" .. path.translate(dir)}
end
--- make the force c include flag
-function nf_cinclude(self, headerfile)
- if self:kind() == "cc" then
- return {"-FI", headerfile}
- end
-end
-
--- make the force c++ include flag
-function nf_cxxinclude(self, headerfile)
- if self:kind() == "cxx" then
+-- make the force include flag
+function nf_forceinclude(self, headerfile, target)
+ local sourcekinds = target:extraconf("forceincludes", headerfile, "sourcekinds")
+ if not sourcekinds or table.contains(table.wrap(sourcekinds), self:kind()) then
return {"-FI", headerfile}
end
end
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 37f1f345a..bf52b8d29 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -278,16 +278,10 @@ function nf_sysincludedir(self, dir)
return {"-isystem", path.translate(dir)}
end
--- make the force c include flag
-function nf_cinclude(self, headerfile)
- if self:kind() == "cc" then
- return {"-include", headerfile}
- end
-end
-
--- make the force c++ include flag
-function nf_cxxinclude(self, headerfile)
- if self:kind() == "cxx" then
+-- make the force include flag
+function nf_forceinclude(self, headerfile, target)
+ local sourcekinds = target:extraconf("forceincludes", headerfile, "sourcekinds")
+ if not sourcekinds or table.contains(table.wrap(sourcekinds), self:kind()) then
return {"-include", headerfile}
end
end