summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-11-09 03:28:18 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-11-11 13:10:18 (GMT)
commit9a5418320ea40d61a63fd47e5ac133c3ff780062 (patch)
treea3acc27189bb2d5b0b8d1f3d792826bc45a6e1f5 /Source/cmGeneratorTarget.cxx
parent929d7a454c8069bae4dece36838ed0db6b65d9cf (diff)
downloadCMake-9a5418320ea40d61a63fd47e5ac133c3ff780062.zip
CMake-9a5418320ea40d61a63fd47e5ac133c3ff780062.tar.gz
CMake-9a5418320ea40d61a63fd47e5ac133c3ff780062.tar.bz2
Unity: Don't include sources with HEADER_FILE_ONLY property set
Fixes: #19946 Fixes: #19947 Co-authored-by: Craig Scott <craig.scott@crascit.com>
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f235af9..77b2a17 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1569,6 +1569,8 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
kind = SourceKindCustomCommand;
} else if (this->Target->GetType() == cmStateEnums::UTILITY) {
kind = SourceKindExtra;
+ } else if (this->IsSourceFilePartOfUnityBatch(sf->ResolveFullPath())) {
+ kind = SourceKindUnityBatched;
} else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
kind = SourceKindHeader;
} else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) {
@@ -3594,6 +3596,23 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
return inserted.first->second;
}
+void cmGeneratorTarget::AddSourceFileToUnityBatch(
+ const std::string& sourceFilename)
+{
+ this->UnityBatchedSourceFiles.insert(sourceFilename);
+}
+
+bool cmGeneratorTarget::IsSourceFilePartOfUnityBatch(
+ const std::string& sourceFilename) const
+{
+ if (!this->GetPropertyAsBool("UNITY_BUILD")) {
+ return false;
+ }
+
+ return this->UnityBatchedSourceFiles.find(sourceFilename) !=
+ this->UnityBatchedSourceFiles.end();
+}
+
void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const