summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-28 00:44:58 +0800
committerruki <[email protected]>2021-09-28 00:44:58 +0800
commit7828621e2165455f90a0b4eecadddec0b7e6cdb0 (patch)
treef07c8136f6cc07ce78f28275c70203a6c5f9fa57 /xmake/core/project/target.lua
parentc828253601411a49e036ec4847155991b5e095e2 (diff)
improve target:sourcekinds
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 3e2d308f9..52126b78c 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1605,6 +1605,15 @@ function _instance:sourcekinds()
table.insert(sourcekinds, sourcekind)
end
end
+ -- if the source file is added dynamically, we may not be able to get the sourcekinds,
+ -- so we can only continue to get it from the rule
+ -- https://github.com/xmake-io/xmake/issues/1622#issuecomment-927726697
+ for _, ruleinst in ipairs(self:orderules()) do
+ local rule_sourcekinds = ruleinst:get("sourcekinds")
+ if rule_sourcekinds then
+ table.insert(sourcekinds, rule_sourcekinds)
+ end
+ end
sourcekinds = table.unique(sourcekinds)
self._SOURCEKINDS = sourcekinds
end