Browse Source

Autogen: For Qt5 pass all implicit include directories to moc

For Qt4 it was not possible to pass all compiler implicit include
directories to moc because it couldn't handle some system headers.
For reference see commit 753b905ec86ffe369d4f59a7a8ced5fedc42939f,
commit d2536579d51e77827b8e55f39123316324314781 and
[QTBUG-28045](https://bugreports.qt.io/browse/QTBUG-28045).

For Qt5's moc the problem does not persist anymore so we can
(and should) pass all implicit include directories to moc.

Fixes #18041
Sebastian Holtermann 7 years ago
parent
commit
f345135845
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Source/cmQtAutoGenInitializer.cxx

+ 5 - 3
Source/cmQtAutoGenInitializer.cxx

@@ -380,13 +380,15 @@ bool cmQtAutoGenInitializer::InitMoc()
 
   // Moc includes
   {
-    auto GetIncludeDirs = [this,
-                           localGen](std::string const& cfg) -> std::string {
+    bool const appendImplicit = (this->QtVersionMajor == "5");
+    auto GetIncludeDirs =
+      [this, localGen, appendImplicit](std::string const& cfg) -> 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
       std::vector<std::string> dirs;
-      localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false);
+      localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false,
+                                      appendImplicit);
       return cmJoin(dirs, ";");
     };