فهرست منبع

Autogen: Reenable passing compiler implicit include directories to moc

Since commit 5990ecb741 (Compute implicit include directories from
compiler output, 2018-12-07) we now have compiler implicit include
directory computation for gcc and clang.  It should be safe now to pass
these to `moc`.  This patch re-enables passing the compiler implicit
include directories to `moc`, which was disabled due to issue #18669.

Fixes: #18041
Issue: #18669
Sebastian Holtermann 6 سال پیش
والد
کامیت
03dbb62d31

+ 3 - 6
Source/cmQtAutoGenInitializer.cxx

@@ -520,13 +520,10 @@ bool cmQtAutoGenInitializer::InitMoc()
 
   // Moc includes
   {
-    // We need to disable this until we have all implicit includes available.
-    // See issue #18669.
-    // bool const appendImplicit = (this->QtVersion.Major >= 5);
-
+    bool const appendImplicit = (this->QtVersion.Major >= 5);
     auto GetIncludeDirs =
-      [this, localGen](std::string const& cfg) -> std::vector<std::string> {
-      bool const appendImplicit = false;
+      [this, localGen,
+       appendImplicit](std::string const& cfg) -> std::vector<std::string> {
       // Get the include dirs for this target, without stripping the implicit
       // include dirs off, see
       // https://gitlab.kitware.com/cmake/cmake/issues/13667

+ 5 - 0
Tests/QtAutogen/MocOsMacros/TestClass.cpp

@@ -1,6 +1,11 @@
 #include "TestClass.hpp"
 #include <iostream>
 
+void TestClass::open()
+{
+  std::cout << "open\n";
+}
+
 // -- Mac
 #ifndef Q_OS_MAC
 void TestClass::MacNotDef()

+ 5 - 0
Tests/QtAutogen/MocOsMacros/TestClass.hpp

@@ -3,12 +3,17 @@
 
 #include <QObject>
 #include <QtGlobal>
+// include qplatformdefs.h for #18669
+#include <qplatformdefs.h>
 
 class TestClass : public QObject
 {
   Q_OBJECT
 public Q_SLOTS:
 
+  // Method named "open" to test if #18669 is fixed
+  void open();
+
 // -- Mac
 #ifndef Q_OS_MAC
   void MacNotDef();

+ 1 - 2
Tests/QtAutogen/Tests.cmake

@@ -39,8 +39,7 @@ endif()
 # Qt5 only tests
 if(QT_TEST_VERSION GREATER 4)
   ADD_AUTOGEN_TEST(MocMacroName mocMacroName)
-  # Disabled for issue #18669
-  #ADD_AUTOGEN_TEST(MocOsMacros)
+  ADD_AUTOGEN_TEST(MocOsMacros)
   ADD_AUTOGEN_TEST(RerunMocPlugin)
   if(APPLE)
     ADD_AUTOGEN_TEST(MacOsFW)