浏览代码

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 年之前
父节点
当前提交
f345135845
共有 1 个文件被更改,包括 5 次插入3 次删除
  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, ";");
     };