summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2020-05-26 11:12:09 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2020-05-26 11:14:27 (GMT)
commit8f2702005a250a9abefedd01596f69ca95518612 (patch)
treef3c53325f3ff09d9f7fd1ec2e5f6779d31112121 /Source/cmLocalGenerator.cxx
parentb8a6300e6eb426eed71e3d9fdc35eb11e5f484f6 (diff)
downloadCMake-8f2702005a250a9abefedd01596f69ca95518612.zip
CMake-8f2702005a250a9abefedd01596f69ca95518612.tar.gz
CMake-8f2702005a250a9abefedd01596f69ca95518612.tar.bz2
AutoMoc: Configure AutoMoc after generated sources (PCH, Unity)
Fixes: #20119
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx8
1 files changed, 7 insertions, 1 deletions
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,