Selaa lähdekoodia

AutoGen: Fix moc and uic dependencies when building Qt itself

When building Qt itself, the moc and uic executables are spcecified
via a generator expression of the form $<TARGET_FILE:Qt6::moc>,
which ends populating Moc's and Uic's 'Executable' field but not the
ExecutableTarget and ExecutableTargetName fields.

In such a scenario, the code in
cmQtAutoGenInitializer::InitAutogenTarget fails to add a dependency
on moc (or uic), because ExecutableTarget is null. First try to add
a dependency on the ExecutableTarget if it's not empty, otherwise try
to add a dependency on the path specified in the 'Executable' field.

Issue: #21118
Alexandru Croitor 5 vuotta sitten
vanhempi
sitoutus
a48bb185c3
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      Source/cmQtAutoGenInitializer.cxx

+ 4 - 0
Source/cmQtAutoGenInitializer.cxx

@@ -1224,9 +1224,13 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
 
 
       if (this->Moc.ExecutableTarget != nullptr) {
       if (this->Moc.ExecutableTarget != nullptr) {
         dependencies.push_back(this->Moc.ExecutableTarget->Target->GetName());
         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) {
       if (this->Uic.ExecutableTarget != nullptr) {
         dependencies.push_back(this->Uic.ExecutableTarget->Target->GetName());
         dependencies.push_back(this->Uic.ExecutableTarget->Target->GetName());
+      } else if (!this->Uic.Executable.empty()) {
+        dependencies.push_back(this->Uic.Executable);
       }
       }
 
 
       // Create the custom command that outputs the timestamp file.
       // Create the custom command that outputs the timestamp file.