summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 38c49ed..ab1de4f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3210,6 +3210,15 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, configs[ci]);
for (cmSourceFile* sf : sources) {
+ // Files which need C++ scanning cannot participate in unity builds as
+ // there is a single place in TUs that may perform module-dependency bits
+ // and a unity source cannot `#include` them in-order and represent a
+ // valid TU.
+ if (sf->GetLanguage() == "CXX"_s &&
+ target->NeedDyndepForSource("CXX", configs[ci], sf)) {
+ continue;
+ }
+
auto mi = index.find(sf);
if (mi == index.end()) {
unitySources.emplace_back(sf);