diff options
| author | ruki <[email protected]> | 2025-05-15 23:35:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-05-15 23:35:16 +0800 |
| commit | 8fe7c166f84ee0460c79a63f5dc19d4ca77dade1 (patch) | |
| tree | 1bb7372dfbd7ec92f6f85b7cebb76d14d0719c06 /xmake/core/project/target.lua | |
| parent | a68eff4a47e81b8ea430ee4f4a86d1fd8ccc7df9 (diff) | |
fix link objectfiles conflicts
Diffstat (limited to 'xmake/core/project/target.lua')
| -rw-r--r-- | xmake/core/project/target.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 974b0c9cc..475c06d19 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -2375,11 +2375,16 @@ function _instance:sourcebatches() sourcebatch.sourcekind = sourcekind -- insert object files to source batches - sourcebatch.objectfiles = sourcebatch.objectfiles or {} - sourcebatch.dependfiles = sourcebatch.dependfiles or {} - local objectfile = self:objectfile(sourcefile, sourcekind) - table.insert(sourcebatch.objectfiles, objectfile) - table.insert(sourcebatch.dependfiles, self:dependfile(objectfile)) + -- and we need to avoid duplication with object files, which may cause some conflicts. + -- e.g. c++.build, c++ module and unity_build rules + -- @see https://github.com/xmake-io/xmake/issues/6420 + if filerule:extraconf("sourcekinds", sourcekind, "objectfiles") ~= false then + sourcebatch.objectfiles = sourcebatch.objectfiles or {} + sourcebatch.dependfiles = sourcebatch.dependfiles or {} + local objectfile = self:objectfile(sourcefile, sourcekind) + table.insert(sourcebatch.objectfiles, objectfile) + table.insert(sourcebatch.dependfiles, self:dependfile(objectfile)) + end end end end |
