diff options
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8a07073..71ab2a6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1568,10 +1568,7 @@ bool cmGlobalGenerator::Compute() // so create the map from project name to vector of local generators this->FillProjectMap(); - // Add automatically generated sources (e.g. unity build). - if (!this->AddAutomaticSources()) { - return false; - } + this->CreateFileGenerateOutputs(); // Iterate through all targets and add verification targets for header sets if (!this->AddHeaderSetVerification()) { @@ -1612,10 +1609,11 @@ bool cmGlobalGenerator::Compute() } } + // Add automatically generated sources (e.g. unity build). // Add unity sources after computing compile features. Unity sources do // not change the set of languages or features, but we need to know them // to filter out sources that are scanned for C++ module dependencies. - if (!this->AddUnitySources()) { + if (!this->AddAutomaticSources()) { return false; } @@ -1885,16 +1883,21 @@ bool cmGlobalGenerator::AddHeaderSetVerification() return true; } -bool cmGlobalGenerator::AddAutomaticSources() +void cmGlobalGenerator::CreateFileGenerateOutputs() { for (const auto& lg : this->LocalGenerators) { lg->CreateEvaluationFileOutputs(); } +} + +bool cmGlobalGenerator::AddAutomaticSources() +{ for (const auto& lg : this->LocalGenerators) { for (const auto& gt : lg->GetGeneratorTargets()) { if (!gt->CanCompileSources()) { continue; } + lg->AddUnityBuild(gt.get()); lg->AddISPCDependencies(gt.get()); // Targets that reuse a PCH are handled below. if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) { @@ -1914,29 +1917,8 @@ bool cmGlobalGenerator::AddAutomaticSources() } } } - // The above transformations may have changed the classification of sources. - // Clear the source list and classification cache (KindedSources) of all - // targets so that it will be recomputed correctly by the generators later - // now that the above transformations are done for all targets. - for (const auto& lg : this->LocalGenerators) { - for (const auto& gt : lg->GetGeneratorTargets()) { - gt->ClearSourcesCache(); - } - } - return true; -} - -bool cmGlobalGenerator::AddUnitySources() -{ - for (const auto& lg : this->LocalGenerators) { - for (const auto& gt : lg->GetGeneratorTargets()) { - if (!gt->CanCompileSources()) { - continue; - } - lg->AddUnityBuild(gt.get()); - } - } - // The above transformation may have changed the classification of sources. + // The above transformations may have changed the classification of sources, + // e.g., sources that go into unity builds become SourceKindUnityBatched. // Clear the source list and classification cache (KindedSources) of all // targets so that it will be recomputed correctly by the generators later // now that the above transformations are done for all targets. |