Browse Source

AutoMoc: Do not list moc macros multiple times

When working on a project with a nested dependency tree, a macro
can be added multiple times. For example in a project I am working
on, in the warning "includes the moc file [... ] but does not contain
a [...] macro" the macro list contains 127 entries but only 25 unique
ones.
David Redondo 4 years ago
parent
commit
8ff0c2b1dd
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Source/cmQtAutoGenInitializer.cxx

+ 3 - 0
Source/cmQtAutoGenInitializer.cxx

@@ -24,6 +24,7 @@
 
 #include "cmsys/SystemInformation.hxx"
 
+#include "cmAlgorithms.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommandLines.h"
 #include "cmGeneratedFileStream.h"
@@ -522,6 +523,8 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       // Filters
       cmExpandList(this->GenTarget->GetSafeProperty("AUTOMOC_MACRO_NAMES"),
                    this->Moc.MacroNames);
+      this->Moc.MacroNames.erase(cmRemoveDuplicates(this->Moc.MacroNames),
+                                 this->Moc.MacroNames.end());
       {
         auto filterList = cmExpandedList(
           this->GenTarget->GetSafeProperty("AUTOMOC_DEPEND_FILTERS"));