summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-12-08 16:21:38 (GMT)
committerBrad King <brad.king@kitware.com>2019-12-08 16:21:38 (GMT)
commitfc9913075213e7636add2a811d41b6f3a7c37374 (patch)
treedbf4f4a0e8c6844d5c2e4efbd3fc552263bb9f48 /Source
parentd71f69649f2085a67ecf27fed890de5a8f1f2362 (diff)
parentfa93b4a59bd639c995ffdf8a5c41dc587c160716 (diff)
downloadCMake-fc9913075213e7636add2a811d41b6f3a7c37374.zip
CMake-fc9913075213e7636add2a811d41b6f3a7c37374.tar.gz
CMake-fc9913075213e7636add2a811d41b6f3a7c37374.tar.bz2
Merge branch 'backport-unity-object-libraries' into unity-object-libraries
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx13
-rw-r--r--Source/cmLocalGenerator.cxx9
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx2
3 files changed, 16 insertions, 8 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8dfc0ce..0e782f2 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1566,13 +1566,24 @@ bool cmGlobalGenerator::AddAutomaticSources()
for (cmLocalGenerator* lg : this->LocalGenerators) {
lg->CreateEvaluationFileOutputs();
for (const auto& gt : lg->GetGeneratorTargets()) {
- if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
+ gt->GetType() == cmStateEnums::UTILITY ||
+ gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
continue;
}
lg->AddUnityBuild(gt.get());
lg->AddPchDependencies(gt.get());
}
}
+ // 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 (cmLocalGenerator* lg : this->LocalGenerators) {
+ for (const auto& gt : lg->GetGeneratorTargets()) {
+ gt->ClearSourcesCache();
+ }
+ }
return true;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7451ff3..50516e0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2393,6 +2393,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
}
const std::string buildType = cmSystemTools::UpperCase(config);
+ // FIXME: Refactor collection of sources to not evaluate object libraries.
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, buildType);
@@ -2549,6 +2550,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/",
target->GetName(), ".dir/Unity/");
+ // FIXME: Refactor collection of sources to not evaluate object libraries.
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, buildType);
@@ -2598,12 +2600,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
for (; begin != end; ++begin) {
cmSourceFile* sf = filtered_sources[begin];
- // Only in Visual Studio generator we keep the source files
- // for explicit processing.
- if (!this->GetGlobalGenerator()->IsMultiConfig() ||
- this->GetGlobalGenerator()->IsXcode()) {
- target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
- }
+ target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
if (beforeInclude) {
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5ffa576..8fc40a79 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2160,7 +2160,6 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
this->WriteExtraSource(e1, si.Source);
break;
case cmGeneratorTarget::SourceKindHeader:
- case cmGeneratorTarget::SourceKindUnityBatched:
this->WriteHeaderSource(e1, si.Source);
break;
case cmGeneratorTarget::SourceKindIDL:
@@ -2172,6 +2171,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
case cmGeneratorTarget::SourceKindModuleDefinition:
tool = "None";
break;
+ case cmGeneratorTarget::SourceKindUnityBatched:
case cmGeneratorTarget::SourceKindObjectSource: {
const std::string& lang = si.Source->GetLanguage();
if (lang == "C" || lang == "CXX") {