summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-10-03 17:34:42 (GMT)
committerBrad King <brad.king@kitware.com>2019-10-03 18:55:22 (GMT)
commit83c1657ff7fda3dc86b49bc9039f59449f2d8ae4 (patch)
treeaa13cfff76c4134309428293f6e69aed364febac /Source/cmGlobalGenerator.cxx
parentd918b4a545fefd1593753189d83ec8590f430579 (diff)
downloadCMake-83c1657ff7fda3dc86b49bc9039f59449f2d8ae4.zip
CMake-83c1657ff7fda3dc86b49bc9039f59449f2d8ae4.tar.gz
CMake-83c1657ff7fda3dc86b49bc9039f59449f2d8ae4.tar.bz2
Unity build: Generate sources during Compute step
The unity build sources need to be added for all generators. Create them during `cmGlobalGenerator::Compute` to avoid duplicating the calls in every generator. We already handle Qt autogen there too. Issue: #19789
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 018037c..ee9ea3c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1381,6 +1381,11 @@ bool cmGlobalGenerator::Compute()
return false;
}
+ // Add automatically generated sources (e.g. unity build).
+ if (!this->AddAutomaticSources()) {
+ return false;
+ }
+
// Add generator specific helper commands
for (cmLocalGenerator* localGen : this->LocalGenerators) {
localGen->AddHelperCommands();
@@ -1548,6 +1553,19 @@ bool cmGlobalGenerator::QtAutoGen()
#endif
}
+bool cmGlobalGenerator::AddAutomaticSources()
+{
+ for (cmLocalGenerator* lg : this->LocalGenerators) {
+ for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) {
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ continue;
+ }
+ lg->AddUnityBuild(gt);
+ }
+ }
+ return true;
+}
+
cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
{