diff options
| author | ruki <[email protected]> | 2023-08-21 23:52:19 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-08-21 23:52:19 +0800 |
| commit | 6f7c5d97b77096be7d883aa98c398d6fdfa1a57e (patch) | |
| tree | e9ce802d35cc63aa12a14ca9070a5ce6fd017be4 /xmake/modules | |
| parent | e426190309d4bca1642254902156d48b0e36f211 (diff) | |
rename to forceincludes
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 14 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 14 |
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 |
