From f550fa3c35f412fd0cba433610d9e747f7d4be3f Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 10 Aug 2022 00:54:48 +0800 Subject: add target:fileconfig_add --- xmake/core/project/target.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index b00cbe15a..faf11b3cc 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1280,6 +1280,24 @@ 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 fileconfig[k] then + fileconfig[k] = table.join(fileconfig[k], v) + else + fileconfig[k] = v + end + end + else + filesconfig[sourcefile] = info + end + self._FILESCONFIG = filesconfig +end + -- get the source files function _instance:sourcefiles() -- cgit v1.3.1