|
@@ -3134,6 +3134,15 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
|
|
|
std::vector<cmSourceFile*> sources;
|
|
std::vector<cmSourceFile*> sources;
|
|
|
target->GetSourceFiles(sources, configs[ci]);
|
|
target->GetSourceFiles(sources, configs[ci]);
|
|
|
for (cmSourceFile* sf : sources) {
|
|
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);
|
|
auto mi = index.find(sf);
|
|
|
if (mi == index.end()) {
|
|
if (mi == index.end()) {
|
|
|
unitySources.emplace_back(sf);
|
|
unitySources.emplace_back(sf);
|