summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-08-06 14:29:17 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-08-06 14:31:23 (GMT)
commitab4895d6b2e5d21222832881ba6523f681f2b3fb (patch)
tree0a61e902c31e43467cdfef234f0fc96e3f593cd0 /Source
parentce4216dedd8d4ceb2c68ab6f0f7fe44a0a10421d (diff)
parent9a9ed4b9d3f9658fa0615bb3cef601c5d396bf3b (diff)
downloadCMake-ab4895d6b2e5d21222832881ba6523f681f2b3fb.zip
CMake-ab4895d6b2e5d21222832881ba6523f681f2b3fb.tar.gz
CMake-ab4895d6b2e5d21222832881ba6523f681f2b3fb.tar.bz2
Merge topic 'automoc_timestamp_deps' into release-3.18
9a9ed4b9d3 Merge branch 'backport-3.17-automoc_timestamp_deps' 7445c9a58a AutoGen: Add test to check for correct AutoMoc dependencies a79056bb02 AutoGen: Fix over-specified direct dependencies of custom command Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Aleix <aleixpol@kde.org> Merge-request: !5085
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenInitializer.cxx47
-rw-r--r--Source/cmQtAutoMocUic.cxx4
2 files changed, 48 insertions, 3 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 511a018..1132852 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1182,11 +1182,54 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
if (useNinjaDepfile) {
// Create a custom command that generates a timestamp file and
// has a depfile assigned. The depfile is created by JobDepFilesMergeT.
-
- // Add additional autogen target dependencies
+ //
+ // Also create an additional '_autogen_timestamp_deps' that the custom
+ // command will depend on. It will have no sources or commands to
+ // execute, but it will have dependencies that would originally be
+ // assigned to the pre-Qt 5.15 'autogen' target. These dependencies will
+ // serve as a list of order-only dependencies for the custom command,
+ // without forcing the custom command to re-execute.
+ //
+ // The dependency tree would then look like
+ // '_autogen_timestamp_deps (order-only)' <- '/timestamp' file <-
+ // '_autogen' target.
+ const auto timestampTargetName =
+ cmStrCat(this->GenTarget->GetName(), "_autogen_timestamp_deps");
+ std::vector<std::string> timestampTargetProvides;
+ cmCustomCommandLines timestampTargetCommandLines;
+
+ // Add additional autogen target dependencies to
+ // '_autogen_timestamp_deps'.
for (const cmTarget* t : this->AutogenTarget.DependTargets) {
dependencies.push_back(t->GetName());
}
+
+ cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
+ timestampTargetName, true, this->Dir.Work.c_str(),
+ /*byproducts=*/timestampTargetProvides,
+ /*depends=*/dependencies, timestampTargetCommandLines, false, nullptr);
+ this->LocalGen->AddGeneratorTarget(
+ cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen));
+
+ // Set FOLDER property on the timestamp target, so it appears in the
+ // appropriate folder in an IDE or in the file api.
+ if (!this->TargetsFolder.empty()) {
+ timestampTarget->SetProperty("FOLDER", this->TargetsFolder);
+ }
+
+ // Make '/timestamp' file depend on '_autogen_timestamp_deps' and on the
+ // moc and uic executables (whichever are enabled).
+ dependencies.clear();
+ dependencies.push_back(timestampTargetName);
+
+ if (this->Moc.ExecutableTarget != nullptr) {
+ dependencies.push_back(this->Moc.ExecutableTarget->Target->GetName());
+ }
+ if (this->Uic.ExecutableTarget != nullptr) {
+ dependencies.push_back(this->Uic.ExecutableTarget->Target->GetName());
+ }
+
+ // Create the custom command that outputs the timestamp file.
const char timestampFileName[] = "timestamp";
const std::string outputFile =
cmStrCat(this->Dir.Build, "/", timestampFileName);
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 9adcabb..f6cccfb 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2163,7 +2163,9 @@ std::string escapeDependencyPath(cm::string_view path)
void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
{
if (Log().Verbose()) {
- Log().Info(GenT::MOC, "Merging MOC dependencies");
+ Log().Info(GenT::MOC,
+ cmStrCat("Merging MOC dependencies into ",
+ MessagePath(BaseConst().DepFile.c_str())));
}
auto processDepFile =
[](const std::string& mocOutputFile) -> std::vector<std::string> {