Browse Source

Merge topic 'mocmacrosonce'

8ff0c2b1dd AutoMoc: Do not list moc macros multiple times
6e2f4029c0 cmAlgorithms: Preserve const-ness in cmRemoveDuplicates range signature

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !6459
Brad King 4 years ago
parent
commit
ed9abd9977
2 changed files with 10 additions and 1 deletions
  1. 7 1
      Source/cmAlgorithms.h
  2. 3 0
      Source/cmQtAutoGenInitializer.cxx

+ 7 - 1
Source/cmAlgorithms.h

@@ -137,7 +137,13 @@ ForwardIterator cmRemoveDuplicates(ForwardIterator first, ForwardIterator last)
 }
 
 template <typename Range>
-typename Range::const_iterator cmRemoveDuplicates(Range& r)
+typename Range::iterator cmRemoveDuplicates(Range& r)
+{
+  return cmRemoveDuplicates(r.begin(), r.end());
+}
+
+template <typename Range>
+typename Range::const_iterator cmRemoveDuplicates(Range const& r)
 {
   return cmRemoveDuplicates(r.begin(), r.end());
 }

+ 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"));