diff options
author | Duncan Barber <7744-dunquan@users.noreply.gitlab.kitware.com> | 2021-04-03 18:52:53 (GMT) |
---|---|---|
committer | Duncan Barber <7744-dunquan@users.noreply.gitlab.kitware.com> | 2021-04-10 17:33:23 (GMT) |
commit | 087b717aefd5439fc5bc6ae25b9795cbb5563e02 (patch) | |
tree | ecf2edaeee0788331abe2549214a6f078adde21d /Source/cmQtAutoGenInitializer.cxx | |
parent | 0656bebeaecb85c2297b3d87634aed6ce8a80f34 (diff) | |
download | CMake-087b717aefd5439fc5bc6ae25b9795cbb5563e02.zip CMake-087b717aefd5439fc5bc6ae25b9795cbb5563e02.tar.gz CMake-087b717aefd5439fc5bc6ae25b9795cbb5563e02.tar.bz2 |
Autogen: Move duplicated executable dependency code into a function
Diffstat (limited to 'Source/cmQtAutoGenInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index f0c799e..a1602bd 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -294,6 +294,17 @@ bool InfoWriter::Save(std::string const& filename) return fileStream.Close(); } +void AddAutogenExecutableToDependencies( + cmQtAutoGenInitializer::GenVarsT const& genVars, + std::vector<std::string>& dependencies) +{ + if (genVars.ExecutableTarget != nullptr) { + dependencies.push_back(genVars.ExecutableTarget->Target->GetName()); + } else if (!genVars.Executable.empty()) { + dependencies.push_back(genVars.Executable); + } +} + } // End of unnamed namespace cmQtAutoGenInitializer::cmQtAutoGenInitializer( @@ -1279,16 +1290,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() dependencies.clear(); dependencies.push_back(timestampTargetName); - if (this->Moc.ExecutableTarget != nullptr) { - dependencies.push_back(this->Moc.ExecutableTarget->Target->GetName()); - } else if (!this->Moc.Executable.empty()) { - dependencies.push_back(this->Moc.Executable); - } - if (this->Uic.ExecutableTarget != nullptr) { - dependencies.push_back(this->Uic.ExecutableTarget->Target->GetName()); - } else if (!this->Uic.Executable.empty()) { - dependencies.push_back(this->Uic.Executable); - } + AddAutogenExecutableToDependencies(this->Moc, dependencies); + AddAutogenExecutableToDependencies(this->Uic, dependencies); // Create the custom command that outputs the timestamp file. const char timestampFileName[] = "timestamp"; |