summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-16 12:33:47 +0800
committerGitHub <[email protected]>2022-08-16 12:33:47 +0800
commit81aca6fbe9149b377cdd88e8ee4b8f045d5a46da (patch)
tree0f138f960ab9fd95265ecbffca7c6ae27d65f4a3 /xmake/core/project/target.lua
parentd46b16f8c40493bfc78764931bf7c3209442696b (diff)
parentd9f82e1bba29adc8b11dc1f7b3887717f03137d6 (diff)
Merge pull request #2641 from xmake-io/cxxmodules
Improve C++20 modules support
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 4397fa701..61f928819 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1280,6 +1280,38 @@ function _instance:fileconfig_set(sourcefile, info)
self._FILESCONFIG = filesconfig
end
+-- add the config info to the given source file
+function _instance:fileconfig_add(sourcefile, info)
+ local filesconfig = self._FILESCONFIG or {}
+ local fileconfig = filesconfig[sourcefile]
+ if fileconfig then
+ for k, v in pairs(info) do
+ if k == "force" then
+ -- fileconfig_add("xxx.c", {force = {cxxflags = ""}})
+ local force = fileconfig[k] or {}
+ for k2, v2 in pairs(v) do
+ if force[k2] then
+ force[k2] = table.join(force[k2], v2)
+ else
+ force[k2] = v2
+ end
+ end
+ fileconfig[k] = force
+ else
+ -- fileconfig_add("xxx.c", {cxxflags = ""})
+ if fileconfig[k] then
+ fileconfig[k] = table.join(fileconfig[k], v)
+ else
+ fileconfig[k] = v
+ end
+ end
+ end
+ else
+ filesconfig[sourcefile] = info
+ end
+ self._FILESCONFIG = filesconfig
+end
+
-- get the source files
function _instance:sourcefiles()