Merge topic 'automoc-skip-pch'

681714ce20 AUTOMOC: Skip PCH when all sources files skip the PCH file too

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7759
This commit is contained in:
Brad King
2022-10-07 14:17:17 +00:00
committed by Kitware Robot
4 changed files with 55 additions and 2 deletions
+20 -2
View File
@@ -1792,13 +1792,16 @@ void cmQtAutoGenInitializer::AddGeneratedSource(ConfigString const& filename,
// XXX(xcode-per-cfg-src): Drop the Xcode-specific part of the condition
// when the Xcode generator supports per-config sources.
if (!this->MultiConfig || this->GlobalGen->IsXcode()) {
this->AddGeneratedSource(filename.Default, genVars, prepend);
cmSourceFile* sf =
this->AddGeneratedSource(filename.Default, genVars, prepend);
handleSkipPch(sf);
return;
}
for (auto const& cfg : this->ConfigsList) {
std::string const& filenameCfg = filename.Config.at(cfg);
// Register source at makefile
this->RegisterGeneratedSource(filenameCfg);
cmSourceFile* sf = this->RegisterGeneratedSource(filenameCfg);
handleSkipPch(sf);
// Add source file to target for this configuration.
this->GenTarget->AddSource(
cmStrCat("$<$<CONFIG:"_s, cfg, ">:"_s, filenameCfg, ">"_s), prepend);
@@ -2158,3 +2161,18 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
return true;
}
void cmQtAutoGenInitializer::handleSkipPch(cmSourceFile* sf)
{
bool skipPch = true;
for (auto const& pair : this->AutogenTarget.Sources) {
if (!pair.first->GetIsGenerated() &&
!pair.first->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
skipPch = false;
}
}
if (skipPch) {
sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
}
}
+2
View File
@@ -154,6 +154,8 @@ private:
bool GetQtExecutable(GenVarsT& genVars, const std::string& executable,
bool ignoreMissingTarget) const;
void handleSkipPch(cmSourceFile* sf);
cmQtAutoGenGlobalInitializer* GlobalInitializer = nullptr;
cmGeneratorTarget* GenTarget = nullptr;
cmGlobalGenerator* GlobalGen = nullptr;