summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-27 12:19:25 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-05-27 12:19:31 (GMT)
commit1174f45990cdbcc486819f87a3ee6f013d22b422 (patch)
tree0595063f79fbce2233f58b2f3b8c008db1e9a6d9
parentb12ac3ebc0e26f224613d2b2488a7ad50e1a85b8 (diff)
parent8f2702005a250a9abefedd01596f69ca95518612 (diff)
downloadCMake-1174f45990cdbcc486819f87a3ee6f013d22b422.zip
CMake-1174f45990cdbcc486819f87a3ee6f013d22b422.tar.gz
CMake-1174f45990cdbcc486819f87a3ee6f013d22b422.tar.bz2
Merge topic 'automoc-after-generated-sources'
8f2702005a AutoMoc: Configure AutoMoc after generated sources (PCH, Unity) Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4792
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmLocalGenerator.cxx8
2 files changed, 11 insertions, 5 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0b7ba04..6f73b0c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1426,13 +1426,13 @@ bool cmGlobalGenerator::Compute()
// so create the map from project name to vector of local generators
this->FillProjectMap();
- // Iterate through all targets and set up AUTOMOC, AUTOUIC and AUTORCC
- if (!this->QtAutoGen()) {
+ // Add automatically generated sources (e.g. unity build).
+ if (!this->AddAutomaticSources()) {
return false;
}
- // Add automatically generated sources (e.g. unity build).
- if (!this->AddAutomaticSources()) {
+ // Iterate through all targets and set up AUTOMOC, AUTOUIC and AUTORCC
+ if (!this->QtAutoGen()) {
return false;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ad1cbd8..e42eb58 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2750,9 +2750,14 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
// Add pchHeader to source files, which will
// be grouped as "Precompile Header File"
auto pchHeader_sf = this->Makefile->GetOrCreateSource(
- pchHeader, false, cmSourceFileLocationKind::Known);
+ pchHeader, true, cmSourceFileLocationKind::Known);
std::string err;
pchHeader_sf->ResolveFullPath(&err);
+
+ // The pch file is generated, but mark it as not generated
+ // so that a clean operation will not remove it from disk
+ pchHeader_sf->SetProperty("GENERATED", "0");
+
target->AddSource(pchHeader);
}
}
@@ -2767,6 +2772,7 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
{
target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
+ sf->SetProperty("SKIP_AUTOGEN", "ON");
}
inline void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file,