[Cmake-commits] CMake branch, master, updated. v3.15.3-1098-g9c31d83

Kitware Robot kwrobot at kitware.com
Thu Sep 19 11:28:32 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  9c31d83aa2a3d3f5921f4a5a559e126e285b96c5 (commit)
       via  cc0900d9cd5fe1fa224d48738965b2928c09f6e7 (commit)
       via  692d8e34927e43a01a799fa5593db8b50a3c0e3a (commit)
       via  1933ade9f1624d6fa4b8a9bf128be96c75b57c68 (commit)
       via  706d9738a614724a96487be074e984a7e86c48c9 (commit)
       via  d018d27c101869e4e2449f938df89d4f97c5b73c (commit)
       via  77983c814725317e990315be8bc8d5b93fa6ffbd (commit)
       via  f9e5441eb43d3238211685cded447141082e37b8 (commit)
       via  51676cf65590f7a9bc3ad247151ee5bdc768eb77 (commit)
       via  1a3f185c1a1f5f67e6c7d8d821f17619208e6311 (commit)
       via  726ea1d15134591c352468b64b3e92f04f2449bb (commit)
       via  05126d23f6a285731dfef940012c6b78feb9fa62 (commit)
       via  f54c5ee52195ae2d73a54faef9399ab977b83a1b (commit)
       via  65c49e0e26488931e6ec27a1d352c07d43171f22 (commit)
       via  dad1a6b3fbf1c9d34a6d2e5722e426234bbb5df0 (commit)
       via  82096911461f37f0421a7a79faa179aa9e0cb25c (commit)
      from  e199294673665e01b1cba48625ec1b18c960c90e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9c31d83aa2a3d3f5921f4a5a559e126e285b96c5
commit 9c31d83aa2a3d3f5921f4a5a559e126e285b96c5
Merge: e199294 cc0900d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 19 15:19:34 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 19 11:19:52 2019 -0400

    Merge topic 'autogen_path_prefix'
    
    cc0900d9cd Help: Add release notes for AUTOMOC_PATH_PREFIX
    692d8e3492 Help: Add documentation for AUTOMOC_PATH_PREFIX
    1933ade9f1 Tests: At QtAutogen.MocIncludeSymlink test
    706d9738a6 Tests: Merge QtAutogen.MocIncludeStrict and MocIncludeRelaxed
    d018d27c10 Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX)
    77983c8147 Autogen: Add IsHeader flag to SourceFileT class
    f9e5441eb4 Autogen: Abbreviate file paths in messages
    51676cf655 Autogen: Split JobEvalCacheT job into separate moc and uic jobs
    ...
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3818

diff --cc Source/cmQtAutoGenInitializer.cxx
index 355141e,1404554..ad4e4d5
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@@ -1093,17 -1121,26 +1114,18 @@@ bool cmQtAutoGenInitializer::InitRccTar
      if (this->MultiConfig) {
        // Build for all configurations
        for (std::string const& config : this->ConfigsList) {
 -        cmCustomCommandLine currentLine;
 -        currentLine.push_back(cmSystemTools::GetCMakeCommand());
 -        currentLine.push_back("-E");
 -        currentLine.push_back("cmake_autorcc");
 -        currentLine.push_back(qrc.InfoFile);
 -        currentLine.push_back(config);
 -        commandLines.push_back(std::move(currentLine));
 +        commandLines.push_back(
 +          cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
 +                              "cmake_autorcc", qrc.InfoFile, config }));
        }
      } else {
 -      cmCustomCommandLine currentLine;
 -      currentLine.push_back(cmSystemTools::GetCMakeCommand());
 -      currentLine.push_back("-E");
 -      currentLine.push_back("cmake_autorcc");
 -      currentLine.push_back(qrc.InfoFile);
 -      currentLine.push_back("$<CONFIG>");
 -      commandLines.push_back(std::move(currentLine));
 +      commandLines.push_back(
 +        cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
 +                            "cmake_autorcc", qrc.InfoFile, "$<CONFIG>" }));
      }
-     std::string ccComment = cmStrCat(
-       "Automatic RCC for ", FileProjectRelativePath(makefile, qrc.QrcFile));
+     std::string ccComment =
+       cmStrCat("Automatic RCC for ",
+                FileProjectRelativePath(this->Makefile, qrc.QrcFile));
  
      if (qrc.Generated || this->Rcc.GlobalTarget) {
        // Create custom rcc target

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc0900d9cd5fe1fa224d48738965b2928c09f6e7
commit cc0900d9cd5fe1fa224d48738965b2928c09f6e7
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sat Sep 14 10:18:51 2019 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 11:48:23 2019 -0400

    Help: Add release notes for AUTOMOC_PATH_PREFIX

diff --git a/Help/release/dev/automoc_path_prefix.rst b/Help/release/dev/automoc_path_prefix.rst
new file mode 100644
index 0000000..bee1b32
--- /dev/null
+++ b/Help/release/dev/automoc_path_prefix.rst
@@ -0,0 +1,13 @@
+automoc_path_prefix
+-------------------
+
+* When using :prop_tgt:`AUTOMOC`, CMake now generates the ``-p`` path prefix
+  option for ``moc``.  This ensures that ``moc`` output files are identical
+  on different build setups (given, that the headers compiled by ``moc`` are
+  in an :command:`include directory <target_include_directories>`).
+  Also it ensures that ``moc`` output files will compile correctly when the
+  source and/or build directory is a symbolic link.
+
+  The ``moc`` path prefix generation behavior can be configured by setting
+  the new :variable:`CMAKE_AUTOMOC_PATH_PREFIX` variable and/or
+  :prop_tgt:`AUTOMOC_PATH_PREFIX` target property.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=692d8e34927e43a01a799fa5593db8b50a3c0e3a
commit 692d8e34927e43a01a799fa5593db8b50a3c0e3a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sat Sep 14 10:00:18 2019 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 11:48:23 2019 -0400

    Help: Add documentation for AUTOMOC_PATH_PREFIX

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 19afb7d..9e54e3e 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -134,6 +134,7 @@ Properties on Targets
    /prop_tgt/AUTOMOC_EXECUTABLE
    /prop_tgt/AUTOMOC_MACRO_NAMES
    /prop_tgt/AUTOMOC_MOC_OPTIONS
+   /prop_tgt/AUTOMOC_PATH_PREFIX
    /prop_tgt/AUTOMOC
    /prop_tgt/AUTOUIC
    /prop_tgt/AUTOUIC_EXECUTABLE
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 2d473d8..def63e4 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -342,6 +342,7 @@ Variables that Control the Build
    /variable/CMAKE_AUTOMOC_DEPEND_FILTERS
    /variable/CMAKE_AUTOMOC_MACRO_NAMES
    /variable/CMAKE_AUTOMOC_MOC_OPTIONS
+   /variable/CMAKE_AUTOMOC_PATH_PREFIX
    /variable/CMAKE_AUTORCC
    /variable/CMAKE_AUTORCC_OPTIONS
    /variable/CMAKE_AUTOUIC
diff --git a/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
new file mode 100644
index 0000000..e2ebb3f
--- /dev/null
+++ b/Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
@@ -0,0 +1,32 @@
+AUTOMOC_PATH_PREFIX
+-------------------
+
+When this property is ``ON``, CMake will generate the ``-p`` path prefix
+option for ``moc`` on :prop_tgt:`AUTOMOC` enabled Qt targets.
+
+To generate the path prefix, CMake tests if the header compiled by ``moc``
+is in any of the target
+:command:`include directories <target_include_directories>`.  If so, CMake will
+compute the relative path accordingly.  If the header is not in the
+:command:`include directories <target_include_directories>`, CMake will omit
+the ``-p`` path prefix option.  ``moc`` usually generates a
+relative include path in that case.
+
+:prop_tgt:`AUTOMOC_PATH_PREFIX` is initialized from the variable
+:variable:`CMAKE_AUTOMOC_PATH_PREFIX`, which is ``ON`` by default.
+
+See the :manual:`cmake-qt(7)` manual for more information on using CMake
+with Qt.
+
+Reproducible builds
+^^^^^^^^^^^^^^^^^^^
+
+For reproducible builds is is recommended to keep headers that are ``moc``
+compiled in one of the target
+:command:`include directories <target_include_directories>` and set
+:prop_tgt:`AUTOMOC_PATH_PREFIX` to ``ON`` (which is the default).  This ensures
+that
+
+- ``moc`` output files are identical on different build setups,
+- ``moc`` output files will compile correctly when the source and/or
+  build directory is a symbolic link.
diff --git a/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst b/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst
new file mode 100644
index 0000000..dca0b06
--- /dev/null
+++ b/Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst
@@ -0,0 +1,11 @@
+CMAKE_AUTOMOC_PATH_PREFIX
+-------------------------
+
+Whether to generate the ``-p`` path prefix option for ``moc`` on
+:prop_tgt:`AUTOMOC` enabled Qt targets.
+
+This variable is used to initialize the :prop_tgt:`AUTOMOC_PATH_PREFIX`
+property on all the targets.  See that target property for additional
+information.
+
+The default value is ``ON``.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1933ade9f1624d6fa4b8a9bf128be96c75b57c68
commit 1933ade9f1624d6fa4b8a9bf128be96c75b57c68
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sun Sep 8 12:58:35 2019 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 11:48:23 2019 -0400

    Tests: At QtAutogen.MocIncludeSymlink test

diff --git a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
new file mode 100644
index 0000000..1627b39
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
@@ -0,0 +1,80 @@
+cmake_minimum_required(VERSION 3.15)
+project(MocIncludeSymlink)
+include("../AutogenCoreTest.cmake")
+
+#
+# Tests if MocInclude can be build when
+# - The source directory is a symbolic link
+# - The build directory is a symbolic link
+#
+
+# -- Utility variables
+set(CS_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(CB_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+
+# Absolute MocInclude path
+get_filename_component(MocIncludePath "../MocInclude" ABSOLUTE)
+message("MocIncludePath: ${MocIncludePath}")
+
+# Use nested subdirectories to ensure relatives paths are correct as well
+set(BUILD_DIR_NORMAL "${CB_DIR}/Build/Normal")
+set(BUILD_DIR_LINKED "${CB_DIR}/Build/Linked")
+
+set(SL_SOURCE_DIR "${CB_DIR}/SL_Source")
+set(SL_BUILD_DIR "${CB_DIR}/SL_Build")
+
+# -- Utility macros
+function(makeSymLink origin link)
+    message("Creating symbolic link\n  Link: ${link}\n  To:   ${origin}")
+    file(CREATE_LINK ${origin} ${link} RESULT res SYMBOLIC)
+    if(NOT (${res} STREQUAL "0"))
+      message("Symlink creation failed.\n  Link: ${link}\n  To:   ${origin}\n  Result: ${res}")
+    endif()
+endfunction()
+
+# -- Make source directory symlink
+makeSymLink(${MocIncludePath} ${SL_SOURCE_DIR} linkResult)
+if(NOT EXISTS ${SL_SOURCE_DIR})
+  message("Directory symlink can't be created.  Skipping test.")
+  return()
+endif()
+
+# -- Make normal build directory
+file(REMOVE_RECURSE ${BUILD_DIR_NORMAL})
+file(MAKE_DIRECTORY ${BUILD_DIR_NORMAL})
+
+# -- Make linked build directory and symlink
+file(REMOVE_RECURSE ${BUILD_DIR_LINKED})
+file(MAKE_DIRECTORY ${BUILD_DIR_LINKED})
+makeSymLink(${BUILD_DIR_LINKED} ${SL_BUILD_DIR} linkResult)
+if(NOT EXISTS ${SL_BUILD_DIR})
+  message("Directory symlink can't be created.  Skipping test.")
+  return()
+endif()
+
+
+# -- Building
+macro(buildMocInclude sourceDir binaryDir)
+  message("Building MocInclude\n  - source dir: ${sourceDir}\n  - binary dir: ${binaryDir}\n")
+  try_compile(result
+    "${binaryDir}"
+    "${sourceDir}"
+    MocInclude
+    CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+                "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+                "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+    OUTPUT_VARIABLE output
+  )
+  if (result)
+    message(STATUS "--- Build success. ---")
+  else()
+    message(STATUS "\n### Building MocInclude failed. ###\n\n--- Output ---\n${output}")
+    message(FATAL_ERROR "--- Building MocInclude failed. End of output. ---")
+  endif()
+endmacro()
+
+message("\nTry building with\n  - symbolic link source dir\n  - non symbolic build dir\n")
+buildMocInclude(${SL_SOURCE_DIR} ${BUILD_DIR_NORMAL})
+
+message("\nTry building with\n  - symbolic link source dir\n  - symbolic link build dir\n")
+buildMocInclude(${SL_SOURCE_DIR} ${SL_BUILD_DIR})
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index 04b50ab..2b001d4 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -33,6 +33,7 @@ ADD_AUTOGEN_TEST(UicSkipSource)
 if(QT_TEST_ALLOW_QT_MACROS)
   ADD_AUTOGEN_TEST(MocCMP0071)
   ADD_AUTOGEN_TEST(MocInclude)
+  ADD_AUTOGEN_TEST(MocIncludeSymlink)
   ADD_AUTOGEN_TEST(MocSkipSource)
 endif()
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=706d9738a614724a96487be074e984a7e86c48c9
commit 706d9738a614724a96487be074e984a7e86c48c9
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sat Sep 7 11:54:05 2019 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 11:48:10 2019 -0400

    Tests: Merge QtAutogen.MocIncludeStrict and MocIncludeRelaxed

diff --git a/Tests/QtAutogen/MocInclude/CMakeLists.txt b/Tests/QtAutogen/MocInclude/CMakeLists.txt
new file mode 100644
index 0000000..04c8baf
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/CMakeLists.txt
@@ -0,0 +1,112 @@
+cmake_minimum_required(VERSION 3.15)
+project(MocInclude)
+get_filename_component(CS_REAL ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
+include("${CS_REAL}/../AutogenCoreTest.cmake")
+
+# Test moc include patterns
+
+set(COM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Common")
+
+macro(addCopyCommand from to)
+    add_custom_command(
+      OUTPUT ${to}
+      COMMAND ${CMAKE_COMMAND} -E copy ${from} ${to}
+      DEPENDS ${from})
+endmacro()
+
+# Create an executable
+function(makeExecutable TARGET_NAME)
+    # Utility variables
+    set(CB_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+
+    # Copy directory
+    file(REMOVE_RECURSE "${CB_DIR}/InIncludes")
+    file(COPY "${COM_DIR}/InIncludes.in" DESTINATION "${CB_DIR}")
+    file(RENAME "${CB_DIR}/InIncludes.in" "${CB_DIR}/InIncludes")
+
+    # Generate .moc file from the header externally and
+    # enabled SKIP_AUTOMOC on the source file
+    qtx_wrap_cpp(ExternDotMOC ${COM_DIR}/ExternDot.hpp OPTIONS "-p" "./")
+    addCopyCommand(${ExternDotMOC}
+                   ${CB_DIR}/ExternDot.moc)
+    set_property(
+      SOURCE ${COM_DIR}/ExternDot.cpp
+      PROPERTY SKIP_AUTOMOC ON)
+
+    # Generate .moc file from the GENERATED header externally
+    # and enabled SKIP_AUTOMOC on the source file
+    addCopyCommand(${COM_DIR}/ExternDotGenerated.hpp.in
+                   ${CB_DIR}/ExternDotGenerated.hpp)
+    addCopyCommand(${COM_DIR}/ExternDotGenerated.cpp.in
+                   ${CB_DIR}/ExternDotGenerated.cpp)
+    qtx_wrap_cpp(ExternDotGeneratedMOC
+                 ${CB_DIR}/ExternDotGenerated.hpp
+                 OPTIONS "-p" "./")
+    addCopyCommand(${ExternDotGeneratedMOC}
+                   ${CB_DIR}/ExternDotGenerated.moc)
+    set_property(
+      SOURCE ${CB_DIR}/ExternDotGenerated.cpp
+      PROPERTY SKIP_AUTOMOC ON)
+
+    # Generate header moc file externally with a custom name
+    # and enabled SKIP_AUTOMOC on the header
+    qtx_wrap_cpp(MixedCustomMOC
+                 ${COM_DIR}/MixedCustom.hpp
+                 OPTIONS "-p" "./")
+    addCopyCommand(${MixedCustomMOC}
+                   ${CB_DIR}/MixedCustom_extMoc.cpp)
+    set_property(
+      SOURCE ${COM_DIR}/MixedCustom.hpp
+      PROPERTY SKIP_AUTOMOC ON)
+    # Custom target to depend on
+    add_custom_target("${TARGET_NAME}_MixedCustom"
+      DEPENDS ${CB_DIR}/MixedCustom_extMoc.cpp
+      BYPRODUCTS ${CB_DIR}/moc_MixedCustom.cpp
+      COMMAND ${CMAKE_COMMAND} -E copy
+        ${COM_DIR}/moc_MixedCustom.cpp.in
+        ${CB_DIR}/moc_MixedCustom.cpp)
+
+    add_executable(${TARGET_NAME}
+      # Test own "*.moc" and "moc_*.cpp" includes
+      ${COM_DIR}/None.cpp
+      ${COM_DIR}/OwnDot.cpp
+      ${COM_DIR}/OwnUnderscore.cpp
+      ${COM_DIR}/OwnDotUnderscore.cpp
+
+      # Test "moc_*.cpp" includes of other files
+      ${COM_DIR}/OtherUnderscore.cpp
+      ${COM_DIR}/OtherUnderscoreExtra.cpp
+      ${COM_DIR}/OtherUnderscoreSub.cpp
+      ${COM_DIR}/OtherUnderscoreSubDir/SubExtra.cpp
+
+      # Test relative ../../ path for moc includes
+      ${COM_DIR}/DualSub/Second/Second.cpp
+      ${COM_DIR}/DualSubMocked.cpp
+
+      # Test externally generated moc files
+      ${COM_DIR}/ExternDot.cpp
+      ${CB_DIR}/ExternDot.moc
+
+      # Test externally generated moc files for GENERATED source
+      ${CB_DIR}/ExternDotGenerated.cpp
+      ${CB_DIR}/ExternDotGenerated.moc
+
+      # Test externally generated moc files and SKIP_AUTOMOC enabled header
+      ${COM_DIR}/MixedSkipped.cpp
+      ${COM_DIR}/MixedCustom.hpp
+      ${COM_DIR}/MixedCustom.cpp
+
+      # Test sources in a subdirectory
+      ${CB_DIR}/InIncludes/SubOwnDot.cpp
+      ${COM_DIR}/InIncludesMoc.cpp
+    )
+    add_dependencies(${TARGET_NAME} "${TARGET_NAME}_MixedCustom")
+    target_include_directories(${TARGET_NAME} PRIVATE "${COM_DIR}")
+    target_include_directories(${TARGET_NAME} PRIVATE "${CB_DIR}")
+    target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
+    target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES})
+    set_target_properties(${TARGET_NAME} PROPERTIES AUTOMOC ON)
+endfunction()
+
+add_subdirectory(Strict)
+add_subdirectory(Relaxed)
diff --git a/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp
new file mode 100644
index 0000000..453add1
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp
@@ -0,0 +1,11 @@
+#include "Second.hpp"
+
+Second::Second()
+{
+}
+
+Second::~Second()
+{
+}
+
+#include "../../moc_DualSubMocked.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp
new file mode 100644
index 0000000..e1f3eac
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp
@@ -0,0 +1,14 @@
+#ifndef Second_HPP
+#define Second_HPP
+
+#include <QObject>
+
+class Second : public QObject
+{
+  Q_OBJECT
+public:
+  Second();
+  ~Second();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp
new file mode 100644
index 0000000..1d4658d
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp
@@ -0,0 +1,9 @@
+#include "DualSubMocked.hpp"
+
+DualSubMocked::DualSubMocked()
+{
+}
+
+DualSubMocked::~DualSubMocked()
+{
+}
diff --git a/Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp
new file mode 100644
index 0000000..58cb571
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp
@@ -0,0 +1,15 @@
+#ifndef DualSubMocked_HPP
+#define DualSubMocked_HPP
+
+#include <QObject>
+
+// Header moc file is included by DualSub/Second/Second.cpp
+class DualSubMocked : public QObject
+{
+  Q_OBJECT
+public:
+  DualSubMocked();
+  ~DualSubMocked();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/ExternDot.cpp b/Tests/QtAutogen/MocInclude/Common/ExternDot.cpp
new file mode 100644
index 0000000..2495aa7
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/ExternDot.cpp
@@ -0,0 +1,11 @@
+#include "ExternDot.hpp"
+
+ExternDot::ExternDot()
+{
+}
+
+ExternDot::~ExternDot()
+{
+}
+
+#include "ExternDot.moc"
diff --git a/Tests/QtAutogen/MocInclude/SObjA.hpp b/Tests/QtAutogen/MocInclude/Common/ExternDot.hpp
similarity index 50%
rename from Tests/QtAutogen/MocInclude/SObjA.hpp
rename to Tests/QtAutogen/MocInclude/Common/ExternDot.hpp
index 1436abc..7eaab2a 100644
--- a/Tests/QtAutogen/MocInclude/SObjA.hpp
+++ b/Tests/QtAutogen/MocInclude/Common/ExternDot.hpp
@@ -1,15 +1,15 @@
-#ifndef SOBJA_HPP
-#define SOBJA_HPP
+#ifndef ExternDot_HPP
+#define ExternDot_HPP
 
 #include <QObject>
 
 // Object source includes externally generated .moc file
-class SObjA : public QObject
+class ExternDot : public QObject
 {
   Q_OBJECT
 public:
-  SObjA();
-  ~SObjA();
+  ExternDot();
+  ~ExternDot();
 };
 
 #endif
diff --git a/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in
new file mode 100644
index 0000000..09ce5cd
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in
@@ -0,0 +1,11 @@
+#include "ExternDotGenerated.hpp"
+
+ExternDotGenerated::ExternDotGenerated()
+{
+}
+
+ExternDotGenerated::~ExternDotGenerated()
+{
+}
+
+#include "ExternDotGenerated.moc"
diff --git a/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in
new file mode 100644
index 0000000..21c69be
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in
@@ -0,0 +1,15 @@
+#ifndef ExternDotGenerated_HPP
+#define ExternDotGenerated_HPP
+
+#include <QObject>
+
+// GENERATED Object source includes externally generated .moc file
+class ExternDotGenerated : public QObject
+{
+  Q_OBJECT
+public:
+  ExternDotGenerated();
+  ~ExternDotGenerated();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp
new file mode 100644
index 0000000..af35711
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp
@@ -0,0 +1,43 @@
+#include "SubOwnDot.hpp"
+#include "SubOwnDot_p.hpp"
+
+namespace InIncludes {
+
+class SubOwnDotLocal : public QObject
+{
+  Q_OBJECT
+public:
+  SubOwnDotLocal();
+  ~SubOwnDotLocal();
+};
+
+SubOwnDotLocal::SubOwnDotLocal()
+{
+}
+
+SubOwnDotLocal::~SubOwnDotLocal()
+{
+}
+
+SubOwnDotPrivate::SubOwnDotPrivate()
+{
+}
+
+SubOwnDotPrivate::~SubOwnDotPrivate()
+{
+}
+
+SubOwnDot::SubOwnDot()
+{
+  SubOwnDotPrivate privateObj;
+  SubOwnDotLocal localObj;
+}
+
+SubOwnDot::~SubOwnDot()
+{
+}
+
+} // End of namespace
+
+// For the local QObject
+#include "SubOwnDot.moc"
diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp
new file mode 100644
index 0000000..038ddfa
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp
@@ -0,0 +1,17 @@
+#ifndef InIncludes_SubOwnDot_HPP
+#define InIncludes_SubOwnDot_HPP
+
+#include <QObject>
+
+namespace InIncludes {
+
+class SubOwnDot : public QObject
+{
+  Q_OBJECT
+public:
+  SubOwnDot();
+  ~SubOwnDot();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp
new file mode 100644
index 0000000..626a9a8
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp
@@ -0,0 +1,18 @@
+#ifndef InIncludes_SubOwnDot_P_HPP
+#define InIncludes_SubOwnDot_P_HPP
+
+#include <QObject>
+
+namespace InIncludes {
+
+class SubOwnDotPrivate : public QObject
+{
+  Q_OBJECT
+public:
+  SubOwnDotPrivate();
+  ~SubOwnDotPrivate();
+};
+
+} // End of namespace
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp b/Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp
new file mode 100644
index 0000000..88f53a4
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp
@@ -0,0 +1,4 @@
+
+// Moc a header that is not in the sources but in a directory that
+// is in the list of include directories.
+#include "InIncludes/moc_SubOwnDot.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp b/Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp
new file mode 100644
index 0000000..557cc62
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp
@@ -0,0 +1,32 @@
+#include "MixedCustom.hpp"
+
+class MixedCustomLocal : public QObject
+{
+  Q_OBJECT
+
+public:
+  MixedCustomLocal();
+  ~MixedCustomLocal();
+};
+
+MixedCustomLocal::MixedCustomLocal()
+{
+}
+
+MixedCustomLocal::~MixedCustomLocal()
+{
+}
+
+MixedCustom::MixedCustom()
+{
+  MixedCustomLocal local;
+}
+
+MixedCustom::~MixedCustom()
+{
+}
+
+// AUTOMOC generated source moc
+#include "MixedCustom.moc"
+// Externally generated header moc
+#include "MixedCustom_extMoc.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp b/Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp
new file mode 100644
index 0000000..6e8ff88
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp
@@ -0,0 +1,20 @@
+#ifndef MixedCustom_HPP
+#define MixedCustom_HPP
+
+#include <QObject>
+
+// Object source includes
+// - externally generated header moc file
+// - AUTOMOC generated source .moc file
+class MixedCustom : public QObject
+{
+  Q_OBJECT
+public:
+  MixedCustom();
+  ~MixedCustom();
+};
+
+// Function forward declaration
+void moc_MixedCustom(MixedCustom const& arg);
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp
new file mode 100644
index 0000000..df08ff1
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp
@@ -0,0 +1,39 @@
+#include "MixedSkipped.hpp"
+#include "MixedCustom.hpp"
+
+class MixedSkippedLocal : public QObject
+{
+  Q_OBJECT
+
+public:
+  MixedSkippedLocal();
+  ~MixedSkippedLocal();
+};
+
+MixedSkippedLocal::MixedSkippedLocal()
+{
+}
+
+MixedSkippedLocal::~MixedSkippedLocal()
+{
+}
+
+MixedSkipped::MixedSkipped()
+{
+  MixedSkippedLocal local;
+  MixedCustom externCutom;
+  // Call moc named function
+  moc_MixedCustom(externCutom);
+}
+
+MixedSkipped::~MixedSkipped()
+{
+}
+
+// Include AUTOMOC generated moc files
+#include "MixedSkipped.moc"
+#include "moc_MixedSkipped.cpp"
+
+// Include externally generated moc_ named file that is not a moc file
+// and for which the relevant header is SKIP_AUTOMOC enabled
+#include "moc_MixedCustom.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp
new file mode 100644
index 0000000..5f6c664
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp
@@ -0,0 +1,17 @@
+#ifndef MixedSkipped_HPP
+#define MixedSkipped_HPP
+
+#include <QObject>
+
+// Object source includes
+// - Own moc_ and .moc files.
+// - externally generated moc_ file from a SKIP_AUTOMOC enabled header
+class MixedSkipped : public QObject
+{
+  Q_OBJECT
+public:
+  MixedSkipped();
+  ~MixedSkipped();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/None.cpp b/Tests/QtAutogen/MocInclude/Common/None.cpp
new file mode 100644
index 0000000..d01d5ec
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/None.cpp
@@ -0,0 +1,20 @@
+#include "None.hpp"
+#include "None_p.h"
+
+NonePrivate::NonePrivate()
+{
+}
+
+NonePrivate::~NonePrivate()
+{
+}
+
+None::None()
+  : d(new NonePrivate)
+{
+}
+
+None::~None()
+{
+  delete d;
+}
diff --git a/Tests/QtAutogen/MocInclude/Common/None.hpp b/Tests/QtAutogen/MocInclude/Common/None.hpp
new file mode 100644
index 0000000..ca0713e
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/None.hpp
@@ -0,0 +1,19 @@
+#ifndef None_HPP
+#define None_HPP
+
+#include <QObject>
+
+// Object source comes without any _moc/.moc includes
+class NonePrivate;
+class None : public QObject
+{
+  Q_OBJECT
+public:
+  None();
+  ~None();
+
+private:
+  NonePrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/None_p.h b/Tests/QtAutogen/MocInclude/Common/None_p.h
new file mode 100644
index 0000000..e209aeb
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/None_p.h
@@ -0,0 +1,14 @@
+#ifndef None_P_HPP
+#define None_P_HPP
+
+#include <QObject>
+
+class NonePrivate : public QObject
+{
+  Q_OBJECT
+public:
+  NonePrivate();
+  ~NonePrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp
new file mode 100644
index 0000000..219619f
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp
@@ -0,0 +1,44 @@
+#include "OtherUnderscore.hpp"
+#include "OtherUnderscoreExtra.hpp"
+#include "OtherUnderscore_p.hpp"
+
+class OtherUnderscoreLocal : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscoreLocal();
+  ~OtherUnderscoreLocal();
+};
+
+OtherUnderscoreLocal::OtherUnderscoreLocal()
+{
+}
+
+OtherUnderscoreLocal::~OtherUnderscoreLocal()
+{
+}
+
+OtherUnderscorePrivate::OtherUnderscorePrivate()
+{
+  OtherUnderscoreLocal localObj;
+  OtherUnderscoreExtra extraObj;
+}
+
+OtherUnderscorePrivate::~OtherUnderscorePrivate()
+{
+}
+
+OtherUnderscore::OtherUnderscore()
+  : d(new OtherUnderscorePrivate)
+{
+}
+
+OtherUnderscore::~OtherUnderscore()
+{
+  delete d;
+}
+
+// For OtherUnderscoreLocal
+#include "OtherUnderscore.moc"
+// - Not the own header
+#include "moc_OtherUnderscoreExtra.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp
new file mode 100644
index 0000000..a4ff603
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp
@@ -0,0 +1,19 @@
+#ifndef OtherUnderscore_HPP
+#define OtherUnderscore_HPP
+
+#include <QObject>
+
+// Sources includes a moc_ includes of an extra object
+class OtherUnderscorePrivate;
+class OtherUnderscore : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscore();
+  ~OtherUnderscore();
+
+private:
+  OtherUnderscorePrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp
new file mode 100644
index 0000000..4ccf080
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp
@@ -0,0 +1,20 @@
+#include "OtherUnderscoreExtra.hpp"
+#include "OtherUnderscoreExtra_p.hpp"
+
+OtherUnderscoreExtraPrivate::OtherUnderscoreExtraPrivate()
+{
+}
+
+OtherUnderscoreExtraPrivate::~OtherUnderscoreExtraPrivate()
+{
+}
+
+OtherUnderscoreExtra::OtherUnderscoreExtra()
+  : d(new OtherUnderscoreExtraPrivate)
+{
+}
+
+OtherUnderscoreExtra::~OtherUnderscoreExtra()
+{
+  delete d;
+}
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp
new file mode 100644
index 0000000..5afe48c
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp
@@ -0,0 +1,18 @@
+#ifndef OtherUnderscoreEXTRA_HPP
+#define OtherUnderscoreEXTRA_HPP
+
+#include <QObject>
+
+class OtherUnderscoreExtraPrivate;
+class OtherUnderscoreExtra : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscoreExtra();
+  ~OtherUnderscoreExtra();
+
+private:
+  OtherUnderscoreExtraPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp
new file mode 100644
index 0000000..2066ac3
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp
@@ -0,0 +1,14 @@
+#ifndef OtherUnderscoreEXTRA_P_HPP
+#define OtherUnderscoreEXTRA_P_HPP
+
+#include <QObject>
+
+class OtherUnderscoreExtraPrivate : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscoreExtraPrivate();
+  ~OtherUnderscoreExtraPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp
new file mode 100644
index 0000000..28850aa
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp
@@ -0,0 +1,45 @@
+#include "OtherUnderscoreSub.hpp"
+#include "OtherUnderscoreSubDir/SubExtra.hpp"
+#include "OtherUnderscoreSub_p.hpp"
+
+class OtherUnderscoreSubLocal : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscoreSubLocal();
+  ~OtherUnderscoreSubLocal();
+};
+
+OtherUnderscoreSubLocal::OtherUnderscoreSubLocal()
+{
+}
+
+OtherUnderscoreSubLocal::~OtherUnderscoreSubLocal()
+{
+}
+
+OtherUnderscoreSubPrivate::OtherUnderscoreSubPrivate()
+{
+  OtherUnderscoreSubLocal localObj;
+  SubExtra extraObj;
+}
+
+OtherUnderscoreSubPrivate::~OtherUnderscoreSubPrivate()
+{
+}
+
+OtherUnderscoreSub::OtherUnderscoreSub()
+  : d(new OtherUnderscoreSubPrivate)
+{
+}
+
+OtherUnderscoreSub::~OtherUnderscoreSub()
+{
+  delete d;
+}
+
+// For OtherUnderscoreSubLocal
+#include "OtherUnderscoreSub.moc"
+// - Not the own header
+// - in a subdirectory
+#include "OtherUnderscoreSubDir/moc_SubExtra.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp
new file mode 100644
index 0000000..7feaa46
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp
@@ -0,0 +1,19 @@
+#ifndef OtherUnderscoreSub_HPP
+#define OtherUnderscoreSub_HPP
+
+#include <QObject>
+
+// Sources includes a moc_ includes of an extra object in a subdirectory
+class OtherUnderscoreSubPrivate;
+class OtherUnderscoreSub : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscoreSub();
+  ~OtherUnderscoreSub();
+
+private:
+  OtherUnderscoreSubPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp
new file mode 100644
index 0000000..e323ed8
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp
@@ -0,0 +1,20 @@
+#include "SubExtra.hpp"
+#include "SubExtra_p.hpp"
+
+SubExtraPrivate::SubExtraPrivate()
+{
+}
+
+SubExtraPrivate::~SubExtraPrivate()
+{
+}
+
+SubExtra::SubExtra()
+  : d(new SubExtraPrivate)
+{
+}
+
+SubExtra::~SubExtra()
+{
+  delete d;
+}
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp
new file mode 100644
index 0000000..5700634
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp
@@ -0,0 +1,18 @@
+#ifndef SubExtra_HPP
+#define SubExtra_HPP
+
+#include <QObject>
+
+class SubExtraPrivate;
+class SubExtra : public QObject
+{
+  Q_OBJECT
+public:
+  SubExtra();
+  ~SubExtra();
+
+private:
+  SubExtraPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp
new file mode 100644
index 0000000..5a14a2d
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp
@@ -0,0 +1,14 @@
+#ifndef SubExtra_P_HPP
+#define SubExtra_P_HPP
+
+#include <QObject>
+
+class SubExtraPrivate : public QObject
+{
+  Q_OBJECT
+public:
+  SubExtraPrivate();
+  ~SubExtraPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp
new file mode 100644
index 0000000..7d5999c
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp
@@ -0,0 +1,14 @@
+#ifndef OtherUnderscoreSub_P_HPP
+#define OtherUnderscoreSub_P_HPP
+
+#include <QObject>
+
+class OtherUnderscoreSubPrivate : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscoreSubPrivate();
+  ~OtherUnderscoreSubPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp
new file mode 100644
index 0000000..96906cf
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp
@@ -0,0 +1,14 @@
+#ifndef OtherUnderscore_P_HPP
+#define OtherUnderscore_P_HPP
+
+#include <QObject>
+
+class OtherUnderscorePrivate : public QObject
+{
+  Q_OBJECT
+public:
+  OtherUnderscorePrivate();
+  ~OtherUnderscorePrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDot.cpp b/Tests/QtAutogen/MocInclude/Common/OwnDot.cpp
new file mode 100644
index 0000000..1cce272
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnDot.cpp
@@ -0,0 +1,39 @@
+#include "OwnDot.hpp"
+#include "OwnDot_p.h"
+
+class OwnDotLocal : public QObject
+{
+  Q_OBJECT
+public:
+  OwnDotLocal();
+  ~OwnDotLocal();
+};
+
+OwnDotLocal::OwnDotLocal()
+{
+}
+
+OwnDotLocal::~OwnDotLocal()
+{
+}
+
+OwnDotPrivate::OwnDotPrivate()
+{
+  OwnDotLocal localObj;
+}
+
+OwnDotPrivate::~OwnDotPrivate()
+{
+}
+
+OwnDot::OwnDot()
+  : d(new OwnDotPrivate)
+{
+}
+
+OwnDot::~OwnDot()
+{
+  delete d;
+}
+
+#include "OwnDot.moc"
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDot.hpp b/Tests/QtAutogen/MocInclude/Common/OwnDot.hpp
new file mode 100644
index 0000000..6f49f12
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnDot.hpp
@@ -0,0 +1,19 @@
+#ifndef OwnDot_HPP
+#define OwnDot_HPP
+
+#include <QObject>
+
+// Object source comes with a .moc include
+class OwnDotPrivate;
+class OwnDot : public QObject
+{
+  Q_OBJECT
+public:
+  OwnDot();
+  ~OwnDot();
+
+private:
+  OwnDotPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp
new file mode 100644
index 0000000..2a0b8ad
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp
@@ -0,0 +1,40 @@
+#include "OwnDotUnderscore.hpp"
+#include "OwnDotUnderscore_p.h"
+
+class OwnDotUnderscoreLocal : public QObject
+{
+  Q_OBJECT
+public:
+  OwnDotUnderscoreLocal();
+  ~OwnDotUnderscoreLocal();
+};
+
+OwnDotUnderscoreLocal::OwnDotUnderscoreLocal()
+{
+}
+
+OwnDotUnderscoreLocal::~OwnDotUnderscoreLocal()
+{
+}
+
+OwnDotUnderscorePrivate::OwnDotUnderscorePrivate()
+{
+  OwnDotUnderscoreLocal localObj;
+}
+
+OwnDotUnderscorePrivate::~OwnDotUnderscorePrivate()
+{
+}
+
+OwnDotUnderscore::OwnDotUnderscore()
+  : d(new OwnDotUnderscorePrivate)
+{
+}
+
+OwnDotUnderscore::~OwnDotUnderscore()
+{
+  delete d;
+}
+
+#include "OwnDotUnderscore.moc"
+#include "moc_OwnDotUnderscore.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp
new file mode 100644
index 0000000..478955c
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp
@@ -0,0 +1,19 @@
+#ifndef LOwnDotUnderscore_HPP
+#define LOwnDotUnderscore_HPP
+
+#include <QObject>
+
+// Object source comes with a .moc and a _moc include
+class OwnDotUnderscorePrivate;
+class OwnDotUnderscore : public QObject
+{
+  Q_OBJECT
+public:
+  OwnDotUnderscore();
+  ~OwnDotUnderscore();
+
+private:
+  OwnDotUnderscorePrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h
new file mode 100644
index 0000000..6950b7f
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h
@@ -0,0 +1,14 @@
+#ifndef OwnDotUnderscore_P_HPP
+#define OwnDotUnderscore_P_HPP
+
+#include <QObject>
+
+class OwnDotUnderscorePrivate : public QObject
+{
+  Q_OBJECT
+public:
+  OwnDotUnderscorePrivate();
+  ~OwnDotUnderscorePrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDot_p.h b/Tests/QtAutogen/MocInclude/Common/OwnDot_p.h
new file mode 100644
index 0000000..f3aff32
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnDot_p.h
@@ -0,0 +1,14 @@
+#ifndef OwnDot_P_HPP
+#define OwnDot_P_HPP
+
+#include <QObject>
+
+class OwnDotPrivate : public QObject
+{
+  Q_OBJECT
+public:
+  OwnDotPrivate();
+  ~OwnDotPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp
new file mode 100644
index 0000000..ebbcf45
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp
@@ -0,0 +1,22 @@
+#include "OwnUnderscore.hpp"
+#include "OwnUnderscore_p.h"
+
+OwnUnderscorePrivate::OwnUnderscorePrivate()
+{
+}
+
+OwnUnderscorePrivate::~OwnUnderscorePrivate()
+{
+}
+
+OwnUnderscore::OwnUnderscore()
+  : d(new OwnUnderscorePrivate)
+{
+}
+
+OwnUnderscore::~OwnUnderscore()
+{
+  delete d;
+}
+
+#include "moc_OwnUnderscore.cpp"
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp
new file mode 100644
index 0000000..e6a6a6e
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp
@@ -0,0 +1,19 @@
+#ifndef OwnUnderscore_HPP
+#define OwnUnderscore_HPP
+
+#include <QObject>
+
+// Object source comes with a _moc include
+class OwnUnderscorePrivate;
+class OwnUnderscore : public QObject
+{
+  Q_OBJECT
+public:
+  OwnUnderscore();
+  ~OwnUnderscore();
+
+private:
+  OwnUnderscorePrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h
new file mode 100644
index 0000000..a3a6b00
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h
@@ -0,0 +1,14 @@
+#ifndef OwnUnderscore_P_HPP
+#define OwnUnderscore_P_HPP
+
+#include <QObject>
+
+class OwnUnderscorePrivate : public QObject
+{
+  Q_OBJECT
+public:
+  OwnUnderscorePrivate();
+  ~OwnUnderscorePrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocInclude/Common/common.cpp.in b/Tests/QtAutogen/MocInclude/Common/common.cpp.in
new file mode 100644
index 0000000..b53e93d
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/common.cpp.in
@@ -0,0 +1,32 @@
+#include "DualSub/Second/Second.hpp"
+#include "DualSubMocked.hpp"
+#include "ExternDot.hpp"
+#include "ExternDotGenerated.hpp"
+#include "None.hpp"
+#include "OtherUnderscore.hpp"
+#include "OtherUnderscoreSub.hpp"
+#include "OwnDot.hpp"
+#include "OwnDotUnderscore.hpp"
+#include "OwnUnderscore.hpp"
+#include "InIncludes/SubOwnDot.hpp"
+
+bool @COMMON_FUNCTION_NAME@()
+{
+  None objNone;
+  OwnUnderscore objOwnUnderscore;
+  OwnDot objOwnDot;
+  OwnDotUnderscore objOwnDotUnderscore;
+
+  OtherUnderscore objOtherUnderscore;
+  OtherUnderscoreSub objOtherUnderscoreSub;
+
+  Second second;
+  DualSubMocked dualSubMocked;
+
+  ExternDot objExternDot;
+  ExternDotGenerated objGeneratedExternDot;
+
+  InIncludes::SubOwnDot subOwnDot;
+
+  return true;
+}
diff --git a/Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in b/Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in
new file mode 100644
index 0000000..6c44793
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in
@@ -0,0 +1,5 @@
+
+void moc_MixedCustom(MixedCustom const & arg)
+{
+    (void)arg;
+}
diff --git a/Tests/QtAutogen/MocInclude/EObjA.cpp b/Tests/QtAutogen/MocInclude/EObjA.cpp
deleted file mode 100644
index 7681c29..0000000
--- a/Tests/QtAutogen/MocInclude/EObjA.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "EObjA.hpp"
-#include "EObjAExtra.hpp"
-#include "EObjA_p.hpp"
-
-class EObjALocal : public QObject
-{
-  Q_OBJECT
-public:
-  EObjALocal();
-  ~EObjALocal();
-};
-
-EObjALocal::EObjALocal()
-{
-}
-
-EObjALocal::~EObjALocal()
-{
-}
-
-EObjAPrivate::EObjAPrivate()
-{
-  EObjALocal localObj;
-  EObjAExtra extraObj;
-}
-
-EObjAPrivate::~EObjAPrivate()
-{
-}
-
-EObjA::EObjA()
-  : d(new EObjAPrivate)
-{
-}
-
-EObjA::~EObjA()
-{
-  delete d;
-}
-
-// For EObjALocal
-#include "EObjA.moc"
-// - Not the own header
-#include "moc_EObjAExtra.cpp"
diff --git a/Tests/QtAutogen/MocInclude/EObjA.hpp b/Tests/QtAutogen/MocInclude/EObjA.hpp
deleted file mode 100644
index 0939ab6..0000000
--- a/Tests/QtAutogen/MocInclude/EObjA.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef EOBJA_HPP
-#define EOBJA_HPP
-
-#include <QObject>
-
-// Sources includes a moc_ includes of an extra object
-class EObjAPrivate;
-class EObjA : public QObject
-{
-  Q_OBJECT
-public:
-  EObjA();
-  ~EObjA();
-
-private:
-  EObjAPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra.cpp b/Tests/QtAutogen/MocInclude/EObjAExtra.cpp
deleted file mode 100644
index 369ca8f..0000000
--- a/Tests/QtAutogen/MocInclude/EObjAExtra.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "EObjAExtra.hpp"
-#include "EObjAExtra_p.hpp"
-
-EObjAExtraPrivate::EObjAExtraPrivate()
-{
-}
-
-EObjAExtraPrivate::~EObjAExtraPrivate()
-{
-}
-
-EObjAExtra::EObjAExtra()
-  : d(new EObjAExtraPrivate)
-{
-}
-
-EObjAExtra::~EObjAExtra()
-{
-  delete d;
-}
diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra.hpp b/Tests/QtAutogen/MocInclude/EObjAExtra.hpp
deleted file mode 100644
index b10681d..0000000
--- a/Tests/QtAutogen/MocInclude/EObjAExtra.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef EOBJAEXTRA_HPP
-#define EOBJAEXTRA_HPP
-
-#include <QObject>
-
-class EObjAExtraPrivate;
-class EObjAExtra : public QObject
-{
-  Q_OBJECT
-public:
-  EObjAExtra();
-  ~EObjAExtra();
-
-private:
-  EObjAExtraPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp b/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp
deleted file mode 100644
index d8bf284..0000000
--- a/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef EOBJAEXTRA_P_HPP
-#define EOBJAEXTRA_P_HPP
-
-#include <QObject>
-
-class EObjAExtraPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  EObjAExtraPrivate();
-  ~EObjAExtraPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/EObjA_p.hpp b/Tests/QtAutogen/MocInclude/EObjA_p.hpp
deleted file mode 100644
index 9ef5624..0000000
--- a/Tests/QtAutogen/MocInclude/EObjA_p.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef EOBJA_P_HPP
-#define EOBJA_P_HPP
-
-#include <QObject>
-
-class EObjAPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  EObjAPrivate();
-  ~EObjAPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/EObjB.cpp b/Tests/QtAutogen/MocInclude/EObjB.cpp
deleted file mode 100644
index 3068c68..0000000
--- a/Tests/QtAutogen/MocInclude/EObjB.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "EObjB.hpp"
-#include "EObjB_p.hpp"
-#include "subExtra/EObjBExtra.hpp"
-
-class EObjBLocal : public QObject
-{
-  Q_OBJECT
-public:
-  EObjBLocal();
-  ~EObjBLocal();
-};
-
-EObjBLocal::EObjBLocal()
-{
-}
-
-EObjBLocal::~EObjBLocal()
-{
-}
-
-EObjBPrivate::EObjBPrivate()
-{
-  EObjBLocal localObj;
-  EObjBExtra extraObj;
-}
-
-EObjBPrivate::~EObjBPrivate()
-{
-}
-
-EObjB::EObjB()
-  : d(new EObjBPrivate)
-{
-}
-
-EObjB::~EObjB()
-{
-  delete d;
-}
-
-// For EObjBLocal
-#include "EObjB.moc"
-// - Not the own header
-// - in a subdirectory
-#include "subExtra/moc_EObjBExtra.cpp"
diff --git a/Tests/QtAutogen/MocInclude/EObjB.hpp b/Tests/QtAutogen/MocInclude/EObjB.hpp
deleted file mode 100644
index 6632bdb..0000000
--- a/Tests/QtAutogen/MocInclude/EObjB.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef EOBJB_HPP
-#define EOBJB_HPP
-
-#include <QObject>
-
-// Sources includes a moc_ includes of an extra object in a subdirectory
-class EObjBPrivate;
-class EObjB : public QObject
-{
-  Q_OBJECT
-public:
-  EObjB();
-  ~EObjB();
-
-private:
-  EObjBPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/EObjB_p.hpp b/Tests/QtAutogen/MocInclude/EObjB_p.hpp
deleted file mode 100644
index 84b1ea2..0000000
--- a/Tests/QtAutogen/MocInclude/EObjB_p.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef EOBJB_P_HPP
-#define EOBJB_P_HPP
-
-#include <QObject>
-
-class EObjBPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  EObjBPrivate();
-  ~EObjBPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/LObjA.cpp b/Tests/QtAutogen/MocInclude/LObjA.cpp
deleted file mode 100644
index 9aae991..0000000
--- a/Tests/QtAutogen/MocInclude/LObjA.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "LObjA.hpp"
-#include "LObjA_p.h"
-
-class LObjALocal : public QObject
-{
-  Q_OBJECT
-public:
-  LObjALocal();
-  ~LObjALocal();
-};
-
-LObjALocal::LObjALocal()
-{
-}
-
-LObjALocal::~LObjALocal()
-{
-}
-
-LObjAPrivate::LObjAPrivate()
-{
-  LObjALocal localObj;
-}
-
-LObjAPrivate::~LObjAPrivate()
-{
-}
-
-LObjA::LObjA()
-  : d(new LObjAPrivate)
-{
-}
-
-LObjA::~LObjA()
-{
-  delete d;
-}
-
-#include "LObjA.moc"
diff --git a/Tests/QtAutogen/MocInclude/LObjA.hpp b/Tests/QtAutogen/MocInclude/LObjA.hpp
deleted file mode 100644
index aac670c..0000000
--- a/Tests/QtAutogen/MocInclude/LObjA.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef LOBJA_HPP
-#define LOBJA_HPP
-
-#include <QObject>
-
-// Object source comes with a .moc include
-class LObjAPrivate;
-class LObjA : public QObject
-{
-  Q_OBJECT
-public:
-  LObjA();
-  ~LObjA();
-
-private:
-  LObjAPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/LObjA_p.h b/Tests/QtAutogen/MocInclude/LObjA_p.h
deleted file mode 100644
index 97113d6..0000000
--- a/Tests/QtAutogen/MocInclude/LObjA_p.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef LOBJA_P_HPP
-#define LOBJA_P_HPP
-
-#include <QObject>
-
-class LObjAPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  LObjAPrivate();
-  ~LObjAPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/LObjB.cpp b/Tests/QtAutogen/MocInclude/LObjB.cpp
deleted file mode 100644
index 7485d8f..0000000
--- a/Tests/QtAutogen/MocInclude/LObjB.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "LObjB.hpp"
-#include "LObjB_p.h"
-
-class LObjBLocal : public QObject
-{
-  Q_OBJECT
-public:
-  LObjBLocal();
-  ~LObjBLocal();
-};
-
-LObjBLocal::LObjBLocal()
-{
-}
-
-LObjBLocal::~LObjBLocal()
-{
-}
-
-LObjBPrivate::LObjBPrivate()
-{
-  LObjBLocal localObj;
-}
-
-LObjBPrivate::~LObjBPrivate()
-{
-}
-
-LObjB::LObjB()
-  : d(new LObjBPrivate)
-{
-}
-
-LObjB::~LObjB()
-{
-  delete d;
-}
-
-#include "LObjB.moc"
-#include "moc_LObjB.cpp"
diff --git a/Tests/QtAutogen/MocInclude/LObjB.hpp b/Tests/QtAutogen/MocInclude/LObjB.hpp
deleted file mode 100644
index eb4e58d..0000000
--- a/Tests/QtAutogen/MocInclude/LObjB.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef LLObjB_HPP
-#define LLObjB_HPP
-
-#include <QObject>
-
-// Object source comes with a .moc and a _moc include
-class LObjBPrivate;
-class LObjB : public QObject
-{
-  Q_OBJECT
-public:
-  LObjB();
-  ~LObjB();
-
-private:
-  LObjBPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/LObjB_p.h b/Tests/QtAutogen/MocInclude/LObjB_p.h
deleted file mode 100644
index b88f40e..0000000
--- a/Tests/QtAutogen/MocInclude/LObjB_p.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef LOBJB_P_HPP
-#define LOBJB_P_HPP
-
-#include <QObject>
-
-class LObjBPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  LObjBPrivate();
-  ~LObjBPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/ObjA.cpp b/Tests/QtAutogen/MocInclude/ObjA.cpp
deleted file mode 100644
index 6f6b90e..0000000
--- a/Tests/QtAutogen/MocInclude/ObjA.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "ObjA.hpp"
-#include "ObjA_p.h"
-
-ObjAPrivate::ObjAPrivate()
-{
-}
-
-ObjAPrivate::~ObjAPrivate()
-{
-}
-
-ObjA::ObjA()
-  : d(new ObjAPrivate)
-{
-}
-
-ObjA::~ObjA()
-{
-  delete d;
-}
diff --git a/Tests/QtAutogen/MocInclude/ObjA.hpp b/Tests/QtAutogen/MocInclude/ObjA.hpp
deleted file mode 100644
index f16c924..0000000
--- a/Tests/QtAutogen/MocInclude/ObjA.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef OBJA_HPP
-#define OBJA_HPP
-
-#include <QObject>
-
-// Object source comes without any _moc/.moc includes
-class ObjAPrivate;
-class ObjA : public QObject
-{
-  Q_OBJECT
-public:
-  ObjA();
-  ~ObjA();
-
-private:
-  ObjAPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/ObjA_p.h b/Tests/QtAutogen/MocInclude/ObjA_p.h
deleted file mode 100644
index d944bc6..0000000
--- a/Tests/QtAutogen/MocInclude/ObjA_p.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef OBJA_P_HPP
-#define OBJA_P_HPP
-
-#include <QObject>
-
-class ObjAPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  ObjAPrivate();
-  ~ObjAPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/ObjB.cpp b/Tests/QtAutogen/MocInclude/ObjB.cpp
deleted file mode 100644
index a6f2509..0000000
--- a/Tests/QtAutogen/MocInclude/ObjB.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "ObjB.hpp"
-#include "ObjB_p.h"
-
-ObjBPrivate::ObjBPrivate()
-{
-}
-
-ObjBPrivate::~ObjBPrivate()
-{
-}
-
-ObjB::ObjB()
-  : d(new ObjBPrivate)
-{
-}
-
-ObjB::~ObjB()
-{
-  delete d;
-}
-
-#include "moc_ObjB.cpp"
diff --git a/Tests/QtAutogen/MocInclude/ObjB.hpp b/Tests/QtAutogen/MocInclude/ObjB.hpp
deleted file mode 100644
index 2ac8d17..0000000
--- a/Tests/QtAutogen/MocInclude/ObjB.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef ObjB_HPP
-#define ObjB_HPP
-
-#include <QObject>
-
-// Object source comes with a _moc include
-class ObjBPrivate;
-class ObjB : public QObject
-{
-  Q_OBJECT
-public:
-  ObjB();
-  ~ObjB();
-
-private:
-  ObjBPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/ObjB_p.h b/Tests/QtAutogen/MocInclude/ObjB_p.h
deleted file mode 100644
index 61ba604..0000000
--- a/Tests/QtAutogen/MocInclude/ObjB_p.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef OBJB_P_HPP
-#define OBJB_P_HPP
-
-#include <QObject>
-
-class ObjBPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  ObjBPrivate();
-  ~ObjBPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt b/Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt
new file mode 100644
index 0000000..048b79c
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Enable relaxed mode
+set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
+
+# Common test
+set(COMMON_FUNCTION_NAME commonRelaxed)
+configure_file(
+  "${COM_DIR}/common.cpp.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/commonRelaxed.cpp")
+
+makeExecutable(libRelaxed)
+target_sources(libRelaxed PRIVATE
+  "${CMAKE_CURRENT_BINARY_DIR}/commonRelaxed.cpp"
+  RObjA.cpp
+  RObjB.cpp
+  RObjC.cpp
+  relaxed.cpp
+  )
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjA.cpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjA.cpp
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjA.hpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjA.hpp
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjB.cpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjB.cpp
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjB.hpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjB.hpp
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjBExtra.hpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjBExtra.hpp
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjC.cpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjC.cpp
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjC.hpp
similarity index 100%
rename from Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp
rename to Tests/QtAutogen/MocInclude/Relaxed/RObjC.hpp
diff --git a/Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp b/Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp
new file mode 100644
index 0000000..5a511b6
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp
@@ -0,0 +1,21 @@
+// AUTOMOC relaxed mode objects
+#include "RObjA.hpp"
+#include "RObjB.hpp"
+#include "RObjC.hpp"
+
+// Forward declaration
+bool commonRelaxed();
+
+int main(int argv, char** args)
+{
+  // Common tests
+  if (!commonRelaxed()) {
+    return -1;
+  }
+
+  // Relaxed tests
+  RObjA rObjA;
+  RObjB rObjB;
+  RObjC rObjC;
+  return 0;
+}
diff --git a/Tests/QtAutogen/MocInclude/SObjA.cpp b/Tests/QtAutogen/MocInclude/SObjA.cpp
deleted file mode 100644
index 7e75bf9..0000000
--- a/Tests/QtAutogen/MocInclude/SObjA.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "SObjA.hpp"
-
-SObjA::SObjA()
-{
-}
-
-SObjA::~SObjA()
-{
-}
-
-#include "SObjA.moc"
diff --git a/Tests/QtAutogen/MocInclude/SObjB.cpp.in b/Tests/QtAutogen/MocInclude/SObjB.cpp.in
deleted file mode 100644
index b1cc12a..0000000
--- a/Tests/QtAutogen/MocInclude/SObjB.cpp.in
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "SObjB.hpp"
-
-SObjB::SObjB()
-{
-}
-
-SObjB::~SObjB()
-{
-}
-
-#include "SObjB.moc"
diff --git a/Tests/QtAutogen/MocInclude/SObjB.hpp.in b/Tests/QtAutogen/MocInclude/SObjB.hpp.in
deleted file mode 100644
index 5e396ae..0000000
--- a/Tests/QtAutogen/MocInclude/SObjB.hpp.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SOBJB_HPP
-#define SOBJB_HPP
-
-#include <QObject>
-
-// Object source includes externally generated .moc file
-class SObjB : public QObject
-{
-  Q_OBJECT
-public:
-  SObjB();
-  ~SObjB();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/SObjC.cpp b/Tests/QtAutogen/MocInclude/SObjC.cpp
deleted file mode 100644
index 1e8d397..0000000
--- a/Tests/QtAutogen/MocInclude/SObjC.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "SObjC.hpp"
-
-void SObjCLocalFunction();
-
-class SObjCLocal : public QObject
-{
-  Q_OBJECT
-
-public:
-  SObjCLocal();
-  ~SObjCLocal();
-};
-
-SObjCLocal::SObjCLocal()
-{
-}
-
-SObjCLocal::~SObjCLocal()
-{
-}
-
-SObjC::SObjC()
-{
-  SObjCLocal localObject;
-  SObjCLocalFunction();
-}
-
-SObjC::~SObjC()
-{
-}
-
-#include "SObjC.moc"
-#include "moc_SObjC.cpp"
-// Include moc_ file for which the header is SKIP_AUTOMOC enabled
-#include "moc_SObjCExtra.cpp"
diff --git a/Tests/QtAutogen/MocInclude/SObjC.hpp b/Tests/QtAutogen/MocInclude/SObjC.hpp
deleted file mode 100644
index def0f9d..0000000
--- a/Tests/QtAutogen/MocInclude/SObjC.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SOBJC_HPP
-#define SOBJC_HPP
-
-#include <QObject>
-
-// Object source includes externally generated .moc file
-class SObjC : public QObject
-{
-  Q_OBJECT
-public:
-  SObjC();
-  ~SObjC();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.cpp b/Tests/QtAutogen/MocInclude/SObjCExtra.cpp
deleted file mode 100644
index 55dd1c3..0000000
--- a/Tests/QtAutogen/MocInclude/SObjCExtra.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "SObjCExtra.hpp"
-
-class SObjCLocalExtra : public QObject
-{
-  Q_OBJECT
-
-public:
-  SObjCLocalExtra();
-  ~SObjCLocalExtra();
-};
-
-SObjCLocalExtra::SObjCLocalExtra()
-{
-}
-
-SObjCLocalExtra::~SObjCLocalExtra()
-{
-}
-
-SObjCExtra::SObjCExtra()
-{
-}
-
-SObjCExtra::~SObjCExtra()
-{
-}
-
-// Externally generated header moc
-#include "SObjCExtra_extMoc.cpp"
-// AUTOMOC generated source moc
-#include "SObjCExtra.moc"
diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.hpp b/Tests/QtAutogen/MocInclude/SObjCExtra.hpp
deleted file mode 100644
index 08545ac..0000000
--- a/Tests/QtAutogen/MocInclude/SObjCExtra.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SOBJCEXTRA_HPP
-#define SOBJCEXTRA_HPP
-
-#include <QObject>
-
-// Object source includes externally generated .moc file
-class SObjCExtra : public QObject
-{
-  Q_OBJECT
-public:
-  SObjCExtra();
-  ~SObjCExtra();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in b/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in
deleted file mode 100644
index 00fc4aa..0000000
--- a/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in
+++ /dev/null
@@ -1,4 +0,0 @@
-
-void SObjCLocalFunction()
-{
-}
diff --git a/Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt b/Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt
new file mode 100644
index 0000000..12c503f
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Disable relaxed mode
+set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
+
+# Common test
+set(COMMON_FUNCTION_NAME commonStrict)
+configure_file(
+  "${COM_DIR}/common.cpp.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/commonStrict.cpp")
+
+makeExecutable(libStrict)
+target_sources(libStrict PRIVATE
+  "${CMAKE_CURRENT_BINARY_DIR}/commonStrict.cpp"
+  strict.cpp
+  )
diff --git a/Tests/QtAutogen/MocInclude/Strict/strict.cpp b/Tests/QtAutogen/MocInclude/Strict/strict.cpp
new file mode 100644
index 0000000..dd24bb0
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/Strict/strict.cpp
@@ -0,0 +1,7 @@
+// Forward declaration
+bool commonStrict();
+
+int main(int argv, char** args)
+{
+  return commonStrict() ? 0 : -1;
+}
diff --git a/Tests/QtAutogen/MocInclude/main.cpp b/Tests/QtAutogen/MocInclude/main.cpp
new file mode 100644
index 0000000..371c5fd
--- /dev/null
+++ b/Tests/QtAutogen/MocInclude/main.cpp
@@ -0,0 +1,9 @@
+
+// Forward declaration
+bool libStrict();
+bool libRelaxed();
+
+int main(int argv, char** args)
+{
+  return (libStrict() && libRelaxed()) ? 0 : -1;
+}
diff --git a/Tests/QtAutogen/MocInclude/shared.cmake b/Tests/QtAutogen/MocInclude/shared.cmake
deleted file mode 100644
index 2ca2841..0000000
--- a/Tests/QtAutogen/MocInclude/shared.cmake
+++ /dev/null
@@ -1,71 +0,0 @@
-# Test moc include patterns
-include_directories("../MocInclude")
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-# Generate .moc file externally and enabled SKIP_AUTOMOC on the file
-qtx_generate_moc(
-  ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.hpp
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc)
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON)
-
-# Generate .moc file externally from generated source file
-# and enabled SKIP_AUTOMOC on the source file
-add_custom_command(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp
-  COMMAND ${CMAKE_COMMAND} -E copy
-    ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.hpp.in
-    ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp)
-add_custom_command(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp
-  COMMAND ${CMAKE_COMMAND} -E copy
-    ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.cpp.in
-    ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp)
-qtx_generate_moc(
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc)
-set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON)
-
-# Generate moc file externally and enabled SKIP_AUTOMOC on the header
-qtx_generate_moc(
-  ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp)
-set_property(
-  SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp
-  PROPERTY SKIP_AUTOMOC ON)
-# Custom target to depend on
-set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp)
-add_custom_target("${MOC_INCLUDE_NAME}_SOBJC"
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp
-  BYPRODUCTS ${SOBJC_MOC}
-  COMMAND ${CMAKE_COMMAND} -E copy
-    ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.moc.in
-    ${SOBJC_MOC})
-
-# MOC_INCLUDE_NAME must be defined by the includer
-add_executable(${MOC_INCLUDE_NAME}
-  # Common sources
-  ../MocInclude/ObjA.cpp
-  ../MocInclude/ObjB.cpp
-
-  ../MocInclude/LObjA.cpp
-  ../MocInclude/LObjB.cpp
-
-  ../MocInclude/EObjA.cpp
-  ../MocInclude/EObjAExtra.cpp
-  ../MocInclude/EObjB.cpp
-  ../MocInclude/subExtra/EObjBExtra.cpp
-
-  ../MocInclude/SObjA.cpp
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp
-  ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc
-  ../MocInclude/SObjC.cpp
-  ../MocInclude/SObjCExtra.hpp
-  ../MocInclude/SObjCExtra.cpp
-
-  ../MocInclude/subGlobal/GObj.cpp
-  main.cpp
-)
-add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC")
-target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES})
-set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp
deleted file mode 100644
index c697866..0000000
--- a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "EObjBExtra.hpp"
-#include "EObjBExtra_p.hpp"
-
-EObjBExtraPrivate::EObjBExtraPrivate()
-{
-}
-
-EObjBExtraPrivate::~EObjBExtraPrivate()
-{
-}
-
-EObjBExtra::EObjBExtra()
-  : d(new EObjBExtraPrivate)
-{
-}
-
-EObjBExtra::~EObjBExtra()
-{
-  delete d;
-}
diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp
deleted file mode 100644
index 3798d7f..0000000
--- a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef EOBJBEXTRA_HPP
-#define EOBJBEXTRA_HPP
-
-#include <QObject>
-
-class EObjBExtraPrivate;
-class EObjBExtra : public QObject
-{
-  Q_OBJECT
-public:
-  EObjBExtra();
-  ~EObjBExtra();
-
-private:
-  EObjBExtraPrivate* const d;
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp
deleted file mode 100644
index 3231fac..0000000
--- a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef EOBJBEXTRA_P_HPP
-#define EOBJBEXTRA_P_HPP
-
-#include <QObject>
-
-class EObjBExtraPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  EObjBExtraPrivate();
-  ~EObjBExtraPrivate();
-};
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp
deleted file mode 100644
index 6b92f21..0000000
--- a/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "GObj.hpp"
-#include "GObj_p.hpp"
-
-namespace subGlobal {
-
-class GObjLocal : public QObject
-{
-  Q_OBJECT
-public:
-  GObjLocal();
-  ~GObjLocal();
-};
-
-GObjLocal::GObjLocal()
-{
-}
-
-GObjLocal::~GObjLocal()
-{
-}
-
-GObjPrivate::GObjPrivate()
-{
-}
-
-GObjPrivate::~GObjPrivate()
-{
-}
-
-GObj::GObj()
-{
-  GObjLocal localObj;
-}
-
-GObj::~GObj()
-{
-}
-}
-
-// For the local QObject
-#include "GObj.moc"
diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp
deleted file mode 100644
index 2f9ee82..0000000
--- a/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef GOBJ_HPP
-#define GOBJ_HPP
-
-#include <QObject>
-
-namespace subGlobal {
-
-class GObj : public QObject
-{
-  Q_OBJECT
-public:
-  GObj();
-  ~GObj();
-};
-}
-
-#endif
diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp
deleted file mode 100644
index 4a43755..0000000
--- a/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef GOBJ_P_HPP
-#define GOBJ_P_HPP
-
-#include <QObject>
-
-namespace subGlobal {
-
-class GObjPrivate : public QObject
-{
-  Q_OBJECT
-public:
-  GObjPrivate();
-  ~GObjPrivate();
-};
-}
-
-#endif
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
deleted file mode 100644
index 8b4da34..0000000
--- a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-project(MocIncludeRelaxed)
-include("../AutogenCoreTest.cmake")
-
-# Test moc include patterns
-set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
-
-# Shared executable
-set(MOC_INCLUDE_NAME "mocIncludeRelaxed")
-include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake)
-
-# Relaxed only executable
-add_executable(mocIncludeRelaxedOnly
-  RObjA.cpp
-  RObjB.cpp
-  RObjC.cpp
-  RMain.cpp
-)
-target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES})
-set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp
deleted file mode 100644
index 5b2c070..0000000
--- a/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Relaxed AUTOMOC objects
-#include "RObjA.hpp"
-#include "RObjB.hpp"
-#include "RObjC.hpp"
-
-int main(int argv, char** args)
-{
-  RObjA rObjA;
-  RObjB rObjB;
-  RObjC rObjC;
-  return 0;
-}
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/main.cpp b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp
deleted file mode 100644
index 5a3148d..0000000
--- a/Tests/QtAutogen/MocIncludeRelaxed/main.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "EObjA.hpp"
-#include "EObjB.hpp"
-#include "LObjA.hpp"
-#include "LObjB.hpp"
-#include "ObjA.hpp"
-#include "ObjB.hpp"
-#include "SObjA.hpp"
-#include "SObjB.hpp"
-#include "subGlobal/GObj.hpp"
-
-int main(int argv, char** args)
-{
-  subGlobal::GObj gObj;
-  ObjA objA;
-  ObjB objB;
-  LObjA lObjA;
-  LObjB lObjB;
-  EObjA eObjA;
-  EObjB eObjB;
-  SObjA sObjA;
-  SObjB sObjB;
-  return 0;
-}
-
-// Header in global subdirectory
-#include "subGlobal/moc_GObj.cpp"
diff --git a/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt
deleted file mode 100644
index d0aaebf..0000000
--- a/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-project(MocIncludeStrict)
-include("../AutogenCoreTest.cmake")
-
-# Test moc include patterns
-set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
-
-# Shared executable
-set(MOC_INCLUDE_NAME "mocIncludeStrict")
-include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake)
diff --git a/Tests/QtAutogen/MocIncludeStrict/main.cpp b/Tests/QtAutogen/MocIncludeStrict/main.cpp
deleted file mode 100644
index 5a3148d..0000000
--- a/Tests/QtAutogen/MocIncludeStrict/main.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "EObjA.hpp"
-#include "EObjB.hpp"
-#include "LObjA.hpp"
-#include "LObjB.hpp"
-#include "ObjA.hpp"
-#include "ObjB.hpp"
-#include "SObjA.hpp"
-#include "SObjB.hpp"
-#include "subGlobal/GObj.hpp"
-
-int main(int argv, char** args)
-{
-  subGlobal::GObj gObj;
-  ObjA objA;
-  ObjB objB;
-  LObjA lObjA;
-  LObjB lObjB;
-  EObjA eObjA;
-  EObjB eObjB;
-  SObjA sObjA;
-  SObjB sObjB;
-  return 0;
-}
-
-// Header in global subdirectory
-#include "subGlobal/moc_GObj.cpp"
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index 6771828..04b50ab 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -32,8 +32,7 @@ ADD_AUTOGEN_TEST(UicSkipSource)
 
 if(QT_TEST_ALLOW_QT_MACROS)
   ADD_AUTOGEN_TEST(MocCMP0071)
-  ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed)
-  ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict)
+  ADD_AUTOGEN_TEST(MocInclude)
   ADD_AUTOGEN_TEST(MocSkipSource)
 endif()
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d018d27c101869e4e2449f938df89d4f97c5b73c
commit d018d27c101869e4e2449f938df89d4f97c5b73c
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Sep 13 15:17:24 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX)
    
    The new `AUTOMOC_PATH_PREFIX` boolean target property enables automatic
    generation of the path prefix `-p` option for `moc`.
    `AUTOMOC_PATH_PREFIX` is initialized from the variable
    `CMAKE_AUTOMOC_PATH_PREFIX`, which is ON by default.
    
    When `AUTOMOC_PATH_PREFIX` is enabled, CMake tests if a `moc`ed header file is
    in one of the include directories.  If so, then the `-p` option, with the
    relative path of the header parent directory to the respective include
    directory, is added to the `moc` command.  If the header file is not in an
    include directory, the `-p` option is omitted.
    
    Closes: #18815 "AUTOMOC: generated files include full relative path,
                    breaking certain reproducible builds"

diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index ddfc7bd..77d8cfd 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -26,6 +26,7 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
 
 set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON)
 set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
+set(CMAKE_AUTOMOC_PATH_PREFIX ON)
 set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE")
 
 # basically all general purpose OSs support shared libs
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 89ef588..1404554 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1376,6 +1376,8 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
       ofs.Write("AM_MOC_OPTIONS",
                 this->GenTarget->GetSafeProperty("AUTOMOC_MOC_OPTIONS"));
       ofs.Write("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE"));
+      ofs.Write("AM_MOC_PATH_PREFIX",
+                this->GenTarget->GetSafeProperty("AUTOMOC_PATH_PREFIX"));
       ofs.Write("AM_MOC_MACRO_NAMES",
                 this->GenTarget->GetSafeProperty("AUTOMOC_MACRO_NAMES"));
       ofs.Write("AM_MOC_DEPEND_FILTERS",
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 7d6ad47..4e4875e 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -279,12 +279,10 @@ void cmQtAutoMocUic::JobMocPredefsT::Process()
     {
       // Compose command
       std::vector<std::string> cmd = MocConst().PredefsCmd;
-      // Add includes
-      cmAppend(cmd, MocConst().Includes);
       // Add definitions
-      for (std::string const& def : MocConst().Definitions) {
-        cmd.emplace_back("-D" + def);
-      }
+      cmAppend(cmd, MocConst().OptionsDefinitions);
+      // Add includes
+      cmAppend(cmd, MocConst().OptionsIncludes);
       // Execute command
       if (!RunProcess(GenT::MOC, result, cmd, reason.get())) {
         LogCommandError(GenT::MOC,
@@ -1385,17 +1383,50 @@ void cmQtAutoMocUic::JobCompileMocT::Process()
 
   // Compose moc command
   std::vector<std::string> cmd;
-  cmd.push_back(MocConst().Executable);
-  // Add options
-  cmAppend(cmd, MocConst().AllOptions);
-  // Add predefs include
-  if (!MocConst().PredefsFileAbs.empty()) {
-    cmd.emplace_back("--include");
-    cmd.push_back(MocConst().PredefsFileAbs);
+  {
+    // Reserve large enough
+    cmd.reserve(MocConst().OptionsDefinitions.size() +
+                MocConst().OptionsIncludes.size() +
+                MocConst().OptionsExtra.size() + 16);
+    cmd.push_back(MocConst().Executable);
+    // Add definitions
+    cmAppend(cmd, MocConst().OptionsDefinitions);
+    // Add includes
+    cmAppend(cmd, MocConst().OptionsIncludes);
+    // Add predefs include
+    if (!MocConst().PredefsFileAbs.empty()) {
+      cmd.emplace_back("--include");
+      cmd.push_back(MocConst().PredefsFileAbs);
+    }
+    // Add path prefix on demand
+    if (MocConst().PathPrefix && Mapping->SourceFile->IsHeader) {
+      for (std::string const& dir : MocConst().IncludePaths) {
+        cm::string_view prefix = sourceFile;
+        if (cmHasPrefix(prefix, dir)) {
+          prefix.remove_prefix(dir.size());
+          if (cmHasPrefix(prefix, '/')) {
+            prefix.remove_prefix(1);
+            auto slashPos = prefix.rfind('/');
+            if (slashPos != cm::string_view::npos) {
+              cmd.emplace_back("-p");
+              cmd.emplace_back(prefix.substr(0, slashPos));
+            } else {
+              cmd.emplace_back("-p");
+              cmd.emplace_back("./");
+            }
+            break;
+          }
+        }
+      }
+    }
+    // Add extra options
+    cmAppend(cmd, MocConst().OptionsExtra);
+    // Add output file
+    cmd.emplace_back("-o");
+    cmd.push_back(outputFile);
+    // Add source file
+    cmd.push_back(sourceFile);
   }
-  cmd.emplace_back("-o");
-  cmd.push_back(outputFile);
-  cmd.push_back(sourceFile);
 
   // Execute moc command
   cmWorkerPool::ProcessResultT result;
@@ -1654,8 +1685,11 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     }
     MocConst_.Definitions = InfoGetConfigList("AM_MOC_DEFINITIONS");
     MocConst_.IncludePaths = InfoGetConfigList("AM_MOC_INCLUDES");
-    MocConst_.Options = InfoGetList("AM_MOC_OPTIONS");
+    MocConst_.OptionsExtra = InfoGetList("AM_MOC_OPTIONS");
+
     MocConst_.RelaxedMode = InfoGetBool("AM_MOC_RELAXED_MODE");
+    MocConst_.PathPrefix = InfoGetBool("AM_MOC_PATH_PREFIX");
+
     for (std::string const& item : InfoGetList("AM_MOC_MACRO_NAMES")) {
       MocConst_.MacroFilters.emplace_back(
         item, ("[\n][ \t]*{?[ \t]*" + item).append("[^a-zA-Z0-9_]"));
@@ -1846,9 +1880,9 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
 
     // Compose moc includes list
     {
+      // Compute framework paths
       std::set<std::string> frameworkPaths;
       for (std::string const& path : MocConst().IncludePaths) {
-        MocConst_.Includes.push_back("-I" + path);
         // Extract framework path
         if (cmHasLiteralSuffix(path, ".framework/Headers")) {
           // Go up twice to get to the framework root
@@ -1858,26 +1892,26 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
             pathComponents.begin(), pathComponents.end() - 2));
         }
       }
+      // Reserve options
+      MocConst_.OptionsIncludes.reserve(MocConst().IncludePaths.size() +
+                                        frameworkPaths.size() * 2);
+      // Append includes
+      for (std::string const& path : MocConst().IncludePaths) {
+        MocConst_.OptionsIncludes.emplace_back("-I" + path);
+      }
       // Append framework includes
       for (std::string const& path : frameworkPaths) {
-        MocConst_.Includes.emplace_back("-F");
-        MocConst_.Includes.push_back(path);
+        MocConst_.OptionsIncludes.emplace_back("-F");
+        MocConst_.OptionsIncludes.push_back(path);
       }
     }
-    // Setup single list with all options
+
+    // Compose moc definitions list
     {
-      // Add includes
-      MocConst_.AllOptions.insert(MocConst_.AllOptions.end(),
-                                  MocConst().Includes.begin(),
-                                  MocConst().Includes.end());
-      // Add definitions
+      MocConst_.OptionsDefinitions.reserve(MocConst().Definitions.size());
       for (std::string const& def : MocConst().Definitions) {
-        MocConst_.AllOptions.push_back("-D" + def);
+        MocConst_.OptionsDefinitions.emplace_back("-D" + def);
       }
-      // Add options
-      MocConst_.AllOptions.insert(MocConst_.AllOptions.end(),
-                                  MocConst().Options.begin(),
-                                  MocConst().Options.end());
     }
   }
 
@@ -1971,10 +2005,18 @@ void cmQtAutoMocUic::SettingsFileRead()
     if (MocConst_.Enabled) {
       cryptoHash.Initialize();
       cha(MocConst().Executable);
-      std::for_each(MocConst().AllOptions.begin(), MocConst().AllOptions.end(),
-                    cha);
-      std::for_each(MocConst().PredefsCmd.begin(), MocConst().PredefsCmd.end(),
-                    cha);
+      for (auto const& item : MocConst().OptionsDefinitions) {
+        cha(item);
+      }
+      for (auto const& item : MocConst().OptionsIncludes) {
+        cha(item);
+      }
+      for (auto const& item : MocConst().OptionsExtra) {
+        cha(item);
+      }
+      for (auto const& item : MocConst().PredefsCmd) {
+        cha(item);
+      }
       for (auto const& filter : MocConst().DependFilters) {
         cha(filter.Key);
       }
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 71cd5f5..43123f2 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -212,16 +212,17 @@ public:
     bool Enabled = false;
     bool SettingsChanged = false;
     bool RelaxedMode = false;
+    bool PathPrefix = false;
     cmFileTime ExecutableTime;
     std::string Executable;
     std::string CompFileAbs;
     std::string PredefsFileAbs;
     std::unordered_set<std::string> SkipList;
     std::vector<std::string> IncludePaths;
-    std::vector<std::string> Includes;
     std::vector<std::string> Definitions;
-    std::vector<std::string> Options;
-    std::vector<std::string> AllOptions;
+    std::vector<std::string> OptionsIncludes;
+    std::vector<std::string> OptionsDefinitions;
+    std::vector<std::string> OptionsExtra;
     std::vector<std::string> PredefsCmd;
     std::vector<KeyExpT> DependFilters;
     std::vector<KeyExpT> MacroFilters;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6637e32..86873ed 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -312,6 +312,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
     initProp("AUTOMOC_MACRO_NAMES");
     initProp("AUTOMOC_MOC_OPTIONS");
     initProp("AUTOUIC_OPTIONS");
+    initProp("AUTOMOC_PATH_PREFIX");
     initProp("AUTOUIC_SEARCH_PATHS");
     initProp("AUTORCC_OPTIONS");
     initProp("LINK_DEPENDS_NO_SHARED");

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77983c814725317e990315be8bc8d5b93fa6ffbd
commit 77983c814725317e990315be8bc8d5b93fa6ffbd
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Sep 13 12:51:07 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Add IsHeader flag to SourceFileT class

diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 0fe83e5..7d6ad47 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -599,7 +599,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalHeader(SourceFileHandleT source)
     }
 
     // Register mapping in headers map
-    RegisterMapping(handle, true);
+    RegisterMapping(handle);
   }
 
   return true;
@@ -690,7 +690,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
                  "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
 
       // Create mapping
-      if (!RegisterIncluded(incKey.Key, source, source, false)) {
+      if (!RegisterIncluded(incKey.Key, source, source)) {
         return false;
       }
       continue;
@@ -701,7 +701,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
       continue;
     }
     // Create mapping
-    if (!RegisterIncluded(incKey.Key, source, std::move(headerHandle), true)) {
+    if (!RegisterIncluded(incKey.Key, source, std::move(headerHandle))) {
       return false;
     }
   }
@@ -714,7 +714,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
       bool const ownMoc = (incKey.Base == sourceBase);
       if (ownMoc && !parseData.Macro.empty()) {
         // Create mapping for the regular use case
-        if (!RegisterIncluded(incKey.Key, source, source, false)) {
+        if (!RegisterIncluded(incKey.Key, source, source)) {
           return false;
         }
         continue;
@@ -767,8 +767,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
                    "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
       }
       // Create mapping
-      if (!RegisterIncluded(incKey.Key, source, std::move(headerHandle),
-                            true)) {
+      if (!RegisterIncluded(incKey.Key, source, std::move(headerHandle))) {
         return false;
       }
     }
@@ -798,7 +797,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
                                MocConst().MacrosString(), " macro."));
       }
       // Create mapping
-      if (!RegisterIncluded(incKey.Key, source, source, false)) {
+      if (!RegisterIncluded(incKey.Key, source, source)) {
         return false;
       }
     }
@@ -843,6 +842,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::FindIncludedHeader(
         if (!handle) {
           handle = std::make_shared<SourceFileT>(testPath);
           handle->FileTime = fileTime;
+          handle->IsHeader = true;
           handle->Moc = true;
         }
         headerHandle = handle;
@@ -873,7 +873,7 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::FindIncludedHeader(
 
 bool cmQtAutoMocUic::JobEvalCacheMocT::RegisterIncluded(
   std::string const& includeString, SourceFileHandleT includerFileHandle,
-  SourceFileHandleT sourceFileHandle, bool sourceIsHeader) const
+  SourceFileHandleT sourceFileHandle) const
 {
   // Check if this file is already included
   MappingHandleT& handle = MocEval().Includes[includeString];
@@ -915,15 +915,16 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::RegisterIncluded(
   handle->OutputFile = Gen()->AbsoluteIncludePath(includeString);
 
   // Register mapping in sources/headers map
-  RegisterMapping(handle, sourceIsHeader);
+  RegisterMapping(handle);
   return true;
 }
 
 void cmQtAutoMocUic::JobEvalCacheMocT::RegisterMapping(
-  MappingHandleT mappingHandle, bool sourceIsHeader) const
+  MappingHandleT mappingHandle) const
 {
-  auto& regMap =
-    sourceIsHeader ? MocEval().HeaderMappings : MocEval().SourceMappings;
+  auto& regMap = mappingHandle->SourceFile->IsHeader
+    ? MocEval().HeaderMappings
+    : MocEval().SourceMappings;
   // Check if source file already gets mapped
   auto& regHandle = regMap[mappingHandle->SourceFile->FileName];
   if (!regHandle) {
@@ -1738,81 +1739,89 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     }
   }
 
-  // - Headers and sources
+  // Headers
   {
-    auto makeSource = [this, &LogInfoError](
-                        std::string const& fileName,
-                        std::string const& fileFlags) -> SourceFileHandleT {
+    // Get file lists
+    cm::string_view const keyFiles = "AM_HEADERS";
+    cm::string_view const keyFlags = "AM_HEADERS_FLAGS";
+    std::vector<std::string> files = InfoGetList(keyFiles);
+    std::vector<std::string> flags = InfoGetList(keyFlags);
+    std::vector<std::string> builds;
+    if (!MatchSizes(keyFiles, keyFlags, files.size(), flags.size())) {
+      return false;
+    }
+    if (MocConst().Enabled) {
+      cm::string_view const keyPaths = "AM_HEADERS_BUILD_PATHS";
+      builds = InfoGetList(keyPaths);
+      if (!MatchSizes(keyFiles, keyPaths, files.size(), builds.size())) {
+        return false;
+      }
+    }
+
+    // Process file lists
+    for (std::size_t ii = 0; ii != files.size(); ++ii) {
+      std::string& fileName(files[ii]);
+      std::string const& fileFlags(flags[ii]);
       if (fileFlags.size() != 2) {
-        LogInfoError("Invalid file flags string size");
-        return SourceFileHandleT();
+        LogInfoError(cmStrCat("Invalid flags string size ", fileFlags.size(),
+                              "in ", keyFlags));
+        return false;
       }
       cmFileTime fileTime;
       if (!fileTime.Load(fileName)) {
-        LogInfoError(cmStrCat("The source file ", this->MessagePath(fileName),
+        LogInfoError(cmStrCat("The header file ", this->MessagePath(fileName),
                               " does not exist."));
-        return SourceFileHandleT();
-      }
-      SourceFileHandleT sfh = std::make_shared<SourceFileT>(fileName);
-      sfh->FileTime = fileTime;
-      sfh->Moc = (fileFlags[0] == 'M');
-      sfh->Uic = (fileFlags[1] == 'U');
-      return sfh;
-    };
-
-    // Headers
-    {
-      // Get file lists
-      cm::string_view const keyFiles = "AM_HEADERS";
-      cm::string_view const keyFlags = "AM_HEADERS_FLAGS";
-      std::vector<std::string> files = InfoGetList(keyFiles);
-      std::vector<std::string> flags = InfoGetList(keyFlags);
-      std::vector<std::string> builds;
-      if (!MatchSizes(keyFiles, keyFlags, files.size(), flags.size())) {
         return false;
       }
-      if (MocConst().Enabled) {
-        cm::string_view const keyPaths = "AM_HEADERS_BUILD_PATHS";
-        builds = InfoGetList(keyPaths);
-        if (!MatchSizes(keyFiles, keyPaths, files.size(), builds.size())) {
-          return false;
-        }
-      }
-      // Process file lists
-      for (std::size_t ii = 0; ii != files.size(); ++ii) {
-        std::string& fileName(files[ii]);
-        SourceFileHandleT sfh = makeSource(fileName, flags[ii]);
-        if (!sfh) {
-          return false;
-        }
-        if (MocConst().Enabled) {
-          sfh->BuildPath = std::move(builds[ii]);
-          if (sfh->BuildPath.empty()) {
-            return LogInfoError("Header file build path is empty");
-          }
+
+      SourceFileHandleT sourceHandle = std::make_shared<SourceFileT>(fileName);
+      sourceHandle->FileTime = fileTime;
+      sourceHandle->IsHeader = true;
+      sourceHandle->Moc = (fileFlags[0] == 'M');
+      sourceHandle->Uic = (fileFlags[1] == 'U');
+
+      if (sourceHandle->Moc && MocConst().Enabled) {
+        sourceHandle->BuildPath = std::move(builds[ii]);
+        if (sourceHandle->BuildPath.empty()) {
+          return LogInfoError("Header file build path is empty");
         }
-        BaseEval().Headers.emplace(std::move(fileName), std::move(sfh));
       }
+      BaseEval().Headers.emplace(std::move(fileName), std::move(sourceHandle));
     }
+  }
 
-    // Sources
-    {
-      cm::string_view const keyFiles = "AM_SOURCES";
-      cm::string_view const keyFlags = "AM_SOURCES_FLAGS";
-      std::vector<std::string> files = InfoGetList(keyFiles);
-      std::vector<std::string> flags = InfoGetList(keyFlags);
-      if (!MatchSizes(keyFiles, keyFlags, files.size(), flags.size())) {
+  // Sources
+  {
+    cm::string_view const keyFiles = "AM_SOURCES";
+    cm::string_view const keyFlags = "AM_SOURCES_FLAGS";
+    std::vector<std::string> files = InfoGetList(keyFiles);
+    std::vector<std::string> flags = InfoGetList(keyFlags);
+    if (!MatchSizes(keyFiles, keyFlags, files.size(), flags.size())) {
+      return false;
+    }
+
+    // Process file lists
+    for (std::size_t ii = 0; ii != files.size(); ++ii) {
+      std::string& fileName(files[ii]);
+      std::string const& fileFlags(flags[ii]);
+      if (fileFlags.size() != 2) {
+        LogInfoError(cmStrCat("Invalid flags string size ", fileFlags.size(),
+                              "in ", keyFlags));
         return false;
       }
-      // Process file lists
-      for (std::size_t ii = 0; ii != files.size(); ++ii) {
-        std::string& fileName(files[ii]);
-        SourceFileHandleT sfh = makeSource(fileName, flags[ii]);
-        if (!sfh) {
-          return false;
-        }
-        BaseEval().Sources.emplace(std::move(fileName), std::move(sfh));
+      cmFileTime fileTime;
+      if (!fileTime.Load(fileName)) {
+        LogInfoError(cmStrCat("The source file ", this->MessagePath(fileName),
+                              " does not exist."));
+        return false;
       }
+
+      SourceFileHandleT sourceHandle = std::make_shared<SourceFileT>(fileName);
+      sourceHandle->FileTime = fileTime;
+      sourceHandle->IsHeader = false;
+      sourceHandle->Moc = (fileFlags[0] == 'M');
+      sourceHandle->Uic = (fileFlags[1] == 'U');
+      BaseEval().Sources.emplace(std::move(fileName), std::move(sourceHandle));
     }
   }
 
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index d77e774..71cd5f5 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -136,6 +136,7 @@ public:
     cmFileTime FileTime;
     ParseCacheT::FileHandleT ParseData;
     std::string BuildPath;
+    bool IsHeader = false;
     bool Moc = false;
     bool Uic = false;
   };
@@ -402,10 +403,8 @@ public:
                             cm::string_view includeBase);
     bool RegisterIncluded(std::string const& includeString,
                           SourceFileHandleT includerFileHandle,
-                          SourceFileHandleT sourceFileHandle,
-                          bool sourceIsHeader) const;
-    void RegisterMapping(MappingHandleT mappingHandle,
-                         bool sourceIsHeader) const;
+                          SourceFileHandleT sourceFileHandle) const;
+    void RegisterMapping(MappingHandleT mappingHandle) const;
     std::string MessageHeader(cm::string_view headerBase) const;
   };
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9e5441eb43d3238211685cded447141082e37b8
commit f9e5441eb43d3238211685cded447141082e37b8
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon Sep 9 17:04:51 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Abbreviate file paths in messages
    
    This introduces the `cmQtAutoGenerator::MessagePath` method, that abbreviates
    paths by placing a
     - "SRC:" prefix in place of the project source directory
     - "BIN:" prefix in place of the project binary directory
    
    The method is used in `AUTO{MOC,UIC,RCC}` when paths are displayed in
    messages.  This makes the messages generated by `AUTO{MOC,UIC,RCC}` shorter
    and improves their readability.

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 7012ef6..89ef588 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1410,6 +1410,11 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
   for (Qrc const& qrc : this->Rcc.Qrcs) {
     InfoWriter ofs(qrc.InfoFile);
     if (ofs) {
+      // Utility lambdas
+      auto MfDef = [this](const char* key) {
+        return this->Makefile->GetSafeDefinition(key);
+      };
+
       // Write
       ofs.Write("# Configurations\n");
       ofs.Write("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE");
@@ -1419,6 +1424,8 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
       ofs.WriteConfig("ARCC_SETTINGS_FILE", qrc.ConfigSettingsFile);
 
       ofs.Write("# Directories\n");
+      ofs.Write("ARCC_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR"));
+      ofs.Write("ARCC_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR"));
       ofs.Write("ARCC_BUILD_DIR", this->Dir.Build);
       ofs.Write("ARCC_INCLUDE_DIR", this->Dir.Include);
       ofs.WriteConfig("ARCC_INCLUDE_DIR", this->Dir.ConfigInclude);
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 80b8741..086b68c 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -93,32 +93,18 @@ void cmQtAutoGenerator::Logger::Warning(GenT genType,
   }
 }
 
-void cmQtAutoGenerator::Logger::WarningFile(GenT genType,
-                                            cm::string_view filename,
-                                            cm::string_view message) const
-{
-  Warning(genType, cmStrCat("  ", Quoted(filename), '\n', message));
-}
-
 void cmQtAutoGenerator::Logger::Error(GenT genType,
                                       cm::string_view message) const
 {
   std::string msg =
-    cmStrCat(HeadLine(cmStrCat(GeneratorName(genType), " error")), message,
-             cmHasSuffix(message, '\n') ? "\n" : "\n\n");
+    cmStrCat('\n', HeadLine(cmStrCat(GeneratorName(genType), " error")),
+             message, cmHasSuffix(message, '\n') ? "\n" : "\n\n");
   {
     std::lock_guard<std::mutex> lock(Mutex_);
     cmSystemTools::Stderr(msg);
   }
 }
 
-void cmQtAutoGenerator::Logger::ErrorFile(GenT genType,
-                                          cm::string_view filename,
-                                          cm::string_view message) const
-{
-  Error(genType, cmStrCat("  ", Quoted(filename), '\n', message));
-}
-
 void cmQtAutoGenerator::Logger::ErrorCommand(
   GenT genType, cm::string_view message,
   std::vector<std::string> const& command, std::string const& output) const
@@ -286,3 +272,16 @@ std::string cmQtAutoGenerator::SettingsFind(std::string const& content,
   }
   return std::string();
 }
+
+std::string cmQtAutoGenerator::MessagePath(cm::string_view path) const
+{
+  std::string res;
+  if (cmHasPrefix(path, ProjectDirs().Source)) {
+    res = cmStrCat("SRC:", path.substr(ProjectDirs().Source.size()));
+  } else if (cmHasPrefix(path, ProjectDirs().Binary)) {
+    res = cmStrCat("BIN:", path.substr(ProjectDirs().Binary.size()));
+  } else {
+    res = std::string(path);
+  }
+  return cmQtAutoGen::Quoted(res);
+}
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 4b8b0b7..371b25c 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -23,9 +23,7 @@ class cmQtAutoGenerator : public cmQtAutoGen
 public:
   // -- Types
 
-  /**
-   * Thread safe logger
-   */
+  /** Thread safe logger.  */
   class Logger
   {
   public:
@@ -45,12 +43,8 @@ public:
     void Info(GenT genType, cm::string_view message) const;
     // -- Log warning
     void Warning(GenT genType, cm::string_view message) const;
-    void WarningFile(GenT genType, cm::string_view filename,
-                     cm::string_view message) const;
     // -- Log error
     void Error(GenT genType, cm::string_view message) const;
-    void ErrorFile(GenT genType, cm::string_view filename,
-                   cm::string_view message) const;
     void ErrorCommand(GenT genType, cm::string_view message,
                       std::vector<std::string> const& command,
                       std::string const& output) const;
@@ -64,6 +58,15 @@ public:
     bool ColorOutput_ = false;
   };
 
+  /** Project directories.  */
+  struct ProjectDirsT
+  {
+    std::string Source;
+    std::string Binary;
+    std::string CurrentSource;
+    std::string CurrentBinary;
+  };
+
   // -- File system methods
   static bool MakeParentDirectory(std::string const& filename);
   static bool FileRead(std::string& content, std::string const& filename,
@@ -91,13 +94,18 @@ public:
   std::string const& InfoDir() const { return InfoDir_; }
   std::string const& InfoConfig() const { return InfoConfig_; }
 
+  // -- Directories
+  ProjectDirsT const& ProjectDirs() const { return ProjectDirs_; }
+
   // -- Utility
   static std::string SettingsFind(std::string const& content, const char* key);
+  std::string MessagePath(cm::string_view path) const;
 
 protected:
   // -- Abstract processing interface
   virtual bool Init(cmMakefile* makefile) = 0;
   virtual bool Process() = 0;
+  ProjectDirsT& ProjectDirsRef() { return ProjectDirs_; }
 
 private:
   // -- Info settings
@@ -105,6 +113,8 @@ private:
   cmFileTime InfoFileTime_;
   std::string InfoDir_;
   std::string InfoConfig_;
+  // -- Directories
+  ProjectDirsT ProjectDirs_;
 };
 
 #endif
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 7b65429..0fe83e5 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -234,13 +234,6 @@ void cmQtAutoMocUic::JobT::LogError(GenT genType,
   Gen()->Log().Error(genType, message);
 }
 
-void cmQtAutoMocUic::JobT::LogFileError(GenT genType, cm::string_view filename,
-                                        cm::string_view message) const
-{
-  Gen()->AbortError();
-  Gen()->Log().ErrorFile(genType, filename, message);
-}
-
 void cmQtAutoMocUic::JobT::LogCommandError(
   GenT genType, cm::string_view message,
   std::vector<std::string> const& command, std::string const& output) const
@@ -265,6 +258,7 @@ bool cmQtAutoMocUic::JobT::RunProcess(GenT genType,
                         info.empty() || cmHasSuffix(info, '\n') ? "" : "\n",
                         QuotedCommand(command), '\n'));
   }
+  // Run command
   return cmWorkerPool::JobT::RunProcess(result, command,
                                         BaseConst().AutogenBuildDir);
 }
@@ -279,7 +273,6 @@ void cmQtAutoMocUic::JobMocPredefsT::Process()
   if (!Update(reason.get())) {
     return;
   }
-  std::string const& predefsFileRel = MocConst().PredefsFileRel;
   std::string const& predefsFileAbs = MocConst().PredefsFileAbs;
   {
     cmWorkerPool::ProcessResultT result;
@@ -296,7 +289,7 @@ void cmQtAutoMocUic::JobMocPredefsT::Process()
       if (!RunProcess(GenT::MOC, result, cmd, reason.get())) {
         LogCommandError(GenT::MOC,
                         cmStrCat("The content generation command for ",
-                                 Quoted(predefsFileRel), " failed.\n",
+                                 MessagePath(predefsFileAbs), " failed.\n",
                                  result.ErrorMessage),
                         cmd, result.StdOut);
         return;
@@ -306,19 +299,20 @@ void cmQtAutoMocUic::JobMocPredefsT::Process()
     // (Re)write predefs file only on demand
     if (cmQtAutoGenerator::FileDiffers(predefsFileAbs, result.StdOut)) {
       if (!cmQtAutoGenerator::FileWrite(predefsFileAbs, result.StdOut)) {
-        LogFileError(GenT::MOC, predefsFileAbs,
-                     cmStrCat("Writing ", Quoted(predefsFileRel), " failed."));
+        LogError(
+          GenT::MOC,
+          cmStrCat("Writing ", MessagePath(predefsFileAbs), " failed."));
         return;
       }
     } else {
       // Touch to update the time stamp
       if (Log().Verbose()) {
-        Log().Info(GenT::MOC, "Touching " + Quoted(predefsFileRel));
+        Log().Info(GenT::MOC, "Touching " + MessagePath(predefsFileAbs));
       }
       if (!cmSystemTools::Touch(predefsFileAbs, false)) {
-        LogFileError(
-          GenT::MOC, predefsFileAbs,
-          cmStrCat("Touching ", Quoted(predefsFileAbs), " failed."));
+        LogError(
+          GenT::MOC,
+          cmStrCat("Touching ", MessagePath(predefsFileAbs), " failed."));
         return;
       }
     }
@@ -326,7 +320,9 @@ void cmQtAutoMocUic::JobMocPredefsT::Process()
 
   // Read file time afterwards
   if (!MocEval().PredefsTime.Load(predefsFileAbs)) {
-    LogFileError(GenT::MOC, predefsFileAbs, "File time reading failed.");
+    LogError(GenT::MOC,
+             cmStrCat("Reading the file time of ", MessagePath(predefsFileAbs),
+                      " failed."));
     return;
   }
 }
@@ -336,7 +332,7 @@ bool cmQtAutoMocUic::JobMocPredefsT::Update(std::string* reason) const
   // Test if the file exists
   if (!MocEval().PredefsTime.Load(MocConst().PredefsFileAbs)) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(MocConst().PredefsFileRel),
+      *reason = cmStrCat("Generating ", MessagePath(MocConst().PredefsFileAbs),
                          ", because it doesn't exist.");
     }
     return true;
@@ -345,7 +341,7 @@ bool cmQtAutoMocUic::JobMocPredefsT::Update(std::string* reason) const
   // Test if the settings changed
   if (MocConst().SettingsChanged) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(MocConst().PredefsFileRel),
+      *reason = cmStrCat("Generating ", MessagePath(MocConst().PredefsFileAbs),
                          ", because the moc settings changed.");
     }
     return true;
@@ -358,8 +354,9 @@ bool cmQtAutoMocUic::JobMocPredefsT::Update(std::string* reason) const
     if (execTime.Load(exec)) {
       if (MocEval().PredefsTime.Older(execTime)) {
         if (reason != nullptr) {
-          *reason = cmStrCat("Generating ", Quoted(MocConst().PredefsFileRel),
-                             " because it is older than ", Quoted(exec), '.');
+          *reason =
+            cmStrCat("Generating ", MessagePath(MocConst().PredefsFileAbs),
+                     " because it is older than ", MessagePath(exec), '.');
         }
         return true;
       }
@@ -376,19 +373,21 @@ bool cmQtAutoMocUic::JobParseT::ReadFile()
   std::string const& fileName = FileHandle->FileName;
   // Write info
   if (Log().Verbose()) {
-    Log().Info(GenT::GEN, "Parsing " + Quoted(fileName));
+    Log().Info(GenT::GEN, cmStrCat("Parsing ", MessagePath(fileName)));
   }
   // Read file content
   {
     std::string error;
     if (!cmQtAutoGenerator::FileRead(Content, fileName, &error)) {
-      LogFileError(GenT::GEN, fileName, "Could not read the file: " + error);
+      LogError(
+        GenT::GEN,
+        cmStrCat("Could not read ", MessagePath(fileName), ".\n", error));
       return false;
     }
   }
   // Warn if empty
   if (Content.empty()) {
-    Log().WarningFile(GenT::GEN, fileName, "The file is empty.");
+    Log().Warning(GenT::GEN, cmStrCat(MessagePath(fileName), " is empty."));
     return false;
   }
   return true;
@@ -557,7 +556,7 @@ std::string cmQtAutoMocUic::JobEvalCacheT::MessageSearchLocations() const
   res.reserve(512);
   for (std::string const& path : SearchLocations) {
     res += "  ";
-    res += Quoted(path);
+    res += MessagePath(path);
     res += '\n';
   }
   return res;
@@ -645,9 +644,9 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
   if (!sourceIncludesDotMoc && !parseData.Macro.empty() &&
       !(relaxedMode && sourceIncludesMocUnderscore)) {
     LogError(GenT::MOC,
-             cmStrCat(sourceFile.FileName, "\ncontains a ",
+             cmStrCat(MessagePath(sourceFile.FileName), "\ncontains a ",
                       Quoted(parseData.Macro), " macro, but does not include ",
-                      Quoted(sourceBase + ".moc"),
+                      MessagePath(sourceBase + ".moc"),
                       "!\nConsider to\n  - add #include \"", sourceBase,
                       ".moc\"\n  - enable SKIP_AUTOMOC for this file"));
     return false;
@@ -660,8 +659,8 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
       std::string const headerBase = cmStrCat(incKey.Dir, incKey.Base);
       if (!FindIncludedHeader(headerHandle, sourceDirPrefix, headerBase)) {
         LogError(GenT::MOC,
-                 cmStrCat(Quoted(sourceFile.FileName),
-                          "\nincludes the moc file ", Quoted(incKey.Key),
+                 cmStrCat(MessagePath(sourceFile.FileName),
+                          "\nincludes the moc file ", MessagePath(incKey.Key),
                           ",\nbut a header ", MessageHeader(headerBase),
                           "\ncould not be found "
                           "in the following directories\n",
@@ -681,12 +680,12 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
       // Issue a warning
       Log().Warning(
         GenT::MOC,
-        cmStrCat(sourceFile.FileName, "\ncontains a ", Quoted(parseData.Macro),
-                 " macro, but does not include ", Quoted(sourceBase + ".moc"),
-                 ".\nInstead it includes ", Quoted(incKey.Key),
-                 ".\nRunning moc on the source\n  ",
-                 Quoted(sourceFile.FileName), "!\nBetter include ",
-                 Quoted(sourceBase + ".moc"),
+        cmStrCat(MessagePath(sourceFile.FileName), "\ncontains a ",
+                 Quoted(parseData.Macro), " macro, but does not include ",
+                 MessagePath(sourceBase + ".moc"), ".\nInstead it includes ",
+                 MessagePath(incKey.Key), ".\nRunning moc on the source\n  ",
+                 MessagePath(sourceFile.FileName), "!\nBetter include ",
+                 MessagePath(sourceBase + ".moc"),
                  " for compatibility with regular mode.\n",
                  "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
 
@@ -729,8 +728,8 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
           LogError(
             GenT::MOC,
             cmStrCat(
-              Quoted(sourceFile.FileName), "\nincludes the moc file ",
-              Quoted(incKey.Key),
+              MessagePath(sourceFile.FileName), "\nincludes the moc file ",
+              MessagePath(incKey.Key),
               ",\nwhich seems to be the moc file from a different source "
               "file.\nCMAKE_AUTOMOC_RELAXED_MODE:\nAlso a matching header ",
               MessageHeader(headerBase),
@@ -747,23 +746,23 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
       if (ownMoc && parseData.Macro.empty()) {
         Log().Warning(
           GenT::MOC,
-          cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
-                   Quoted(incKey.Key), ", but does not contain a\n",
-                   MocConst().MacrosString(),
+          cmStrCat(MessagePath(sourceFile.FileName),
+                   "\nincludes the moc file ", MessagePath(incKey.Key),
+                   ", but does not contain a\n", MocConst().MacrosString(),
                    " macro.\nRunning moc on the header\n  ",
-                   Quoted(headerHandle->FileName), "!\nBetter include ",
-                   Quoted("moc_" + incKey.Base + ".cpp"),
+                   MessagePath(headerHandle->FileName), "!\nBetter include ",
+                   MessagePath("moc_" + incKey.Base + ".cpp"),
                    " for a compatibility with regular mode.\n",
                    "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
       } else {
         Log().Warning(
           GenT::MOC,
-          cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
-                   Quoted(incKey.Key), " instead of ",
-                   Quoted("moc_" + incKey.Base + ".cpp"),
+          cmStrCat(MessagePath(sourceFile.FileName),
+                   "\nincludes the moc file ", MessagePath(incKey.Key),
+                   " instead of ", MessagePath("moc_" + incKey.Base + ".cpp"),
                    ".\nRunning moc on the header\n  ",
-                   Quoted(headerHandle->FileName), "!\nBetter include ",
-                   Quoted("moc_" + incKey.Base + ".cpp"),
+                   MessagePath(headerHandle->FileName), "!\nBetter include ",
+                   MessagePath("moc_" + incKey.Base + ".cpp"),
                    " for compatibility with regular mode.\n",
                    "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
       }
@@ -781,19 +780,21 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
       if (!ownMoc) {
         // Don't allow <BASE>.moc include other than own in regular mode
         LogError(GenT::MOC,
-                 cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
-                          Quoted(incKey.Key),
+                 cmStrCat(MessagePath(sourceFile.FileName),
+                          "\nincludes the moc file ", MessagePath(incKey.Key),
                           ",\nwhich seems to be the moc file from a different "
                           "source file.\nThis is not supported.  Include ",
-                          Quoted(sourceBase + ".moc"),
+                          MessagePath(sourceBase + ".moc"),
                           " to run moc on this source file."));
         return false;
       }
       // Accept but issue a warning if moc isn't required
       if (parseData.Macro.empty()) {
         Log().Warning(GenT::MOC,
-                      cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
-                               Quoted(incKey.Key), ", but does not contain a ",
+                      cmStrCat(MessagePath(sourceFile.FileName),
+                               "\nincludes the moc file ",
+                               MessagePath(incKey.Key),
+                               ", but does not contain a ",
                                MocConst().MacrosString(), " macro."));
       }
       // Create mapping
@@ -880,18 +881,19 @@ bool cmQtAutoMocUic::JobEvalCacheMocT::RegisterIncluded(
     // Check if the output file would be generated from different source files
     if (handle->SourceFile != sourceFileHandle) {
       std::string files =
-        cmStrCat("  ", Quoted(includerFileHandle->FileName), '\n');
+        cmStrCat("  ", MessagePath(includerFileHandle->FileName), '\n');
       for (auto const& item : handle->IncluderFiles) {
-        files += cmStrCat("  ", Quoted(item->FileName), '\n');
+        files += cmStrCat("  ", MessagePath(item->FileName), '\n');
       }
       LogError(
         GenT::MOC,
         cmStrCat("The source files\n", files,
-                 "contain the same include string ", Quoted(includeString),
+                 "contain the same include string ",
+                 MessagePath(includeString),
                  ", but\nthe moc file would be generated from different "
                  "source files\n  ",
-                 Quoted(sourceFileHandle->FileName), " and\n  ",
-                 Quoted(handle->SourceFile->FileName),
+                 MessagePath(sourceFileHandle->FileName), " and\n  ",
+                 MessagePath(handle->SourceFile->FileName),
                  ".\nConsider to\n"
                  "  - not include the \"moc_<NAME>.cpp\" file\n"
                  "  - add a directory prefix to a \"<NAME>.moc\" include "
@@ -938,7 +940,7 @@ void cmQtAutoMocUic::JobEvalCacheMocT::RegisterMapping(
 std::string cmQtAutoMocUic::JobEvalCacheMocT::MessageHeader(
   cm::string_view headerBase) const
 {
-  return Quoted(cmStrCat(
+  return MessagePath(cmStrCat(
     headerBase, ".{", cmJoin(this->BaseConst().HeaderExtensions, ","), '}'));
 }
 
@@ -976,9 +978,9 @@ bool cmQtAutoMocUic::JobEvalCacheUicT::EvalFile(
     UiName = cmStrCat(incKey.Base, ".ui");
     if (!FindIncludedUi(sourceDirPrefix, incKey.Dir)) {
       LogError(GenT::UIC,
-               cmStrCat(sourceFile.FileName, "\nincludes the uic file ",
-                        Quoted(incKey.Key), ",\nbut the user interface file ",
-                        Quoted(UiName),
+               cmStrCat(MessagePath(sourceFile.FileName),
+                        "\nincludes the uic file ", MessagePath(incKey.Key),
+                        ",\nbut the user interface file ", MessagePath(UiName),
                         "\ncould not be found in the following directories\n",
                         MessageSearchLocations()));
       return false;
@@ -1060,9 +1062,9 @@ bool cmQtAutoMocUic::JobEvalCacheUicT::RegisterMapping(
     if (handle->SourceFile != UiFileHandle) {
       // The output file already gets generated - from a different .ui file!
       std::string files =
-        cmStrCat("  ", Quoted(includerFileHandle->FileName), '\n');
+        cmStrCat("  ", MessagePath(includerFileHandle->FileName), '\n');
       for (auto const& item : handle->IncluderFiles) {
-        files += cmStrCat("  ", Quoted(item->FileName), '\n');
+        files += cmStrCat("  ", MessagePath(item->FileName), '\n');
       }
       LogError(
         GenT::UIC,
@@ -1071,8 +1073,8 @@ bool cmQtAutoMocUic::JobEvalCacheUicT::RegisterMapping(
           Quoted(includeString),
           ", but\nthe uic file would be generated from different "
           "user interface files\n  ",
-          Quoted(UiFileHandle->FileName), " and\n  ",
-          Quoted(handle->SourceFile->FileName),
+          MessagePath(UiFileHandle->FileName), " and\n  ",
+          MessagePath(handle->SourceFile->FileName),
           ".\nConsider to\n"
           "  - add a directory prefix to a \"ui_<NAME>.h\" include "
           "(e.g \"sub/ui_<NAME>.h\")\n"
@@ -1168,8 +1170,8 @@ bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
   if (!outputFileTime.Load(outputFile)) {
     if (reason != nullptr) {
       *reason =
-        cmStrCat("Generating ", Quoted(outputFile),
-                 ", because it doesn't exist, from ", Quoted(sourceFile));
+        cmStrCat("Generating ", MessagePath(outputFile),
+                 ", because it doesn't exist, from ", MessagePath(sourceFile));
     }
     return true;
   }
@@ -1177,9 +1179,9 @@ bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
   // Test if any setting changed
   if (MocConst().SettingsChanged) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(outputFile),
+      *reason = cmStrCat("Generating ", MessagePath(outputFile),
                          ", because the uic settings changed, from ",
-                         Quoted(sourceFile));
+                         MessagePath(sourceFile));
     }
     return true;
   }
@@ -1187,9 +1189,9 @@ bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
   // Test if the source file is newer
   if (outputFileTime.Older(mapping.SourceFile->FileTime)) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(outputFile),
+      *reason = cmStrCat("Generating ", MessagePath(outputFile),
                          ", because it's older than its source file, from ",
-                         Quoted(sourceFile));
+                         MessagePath(sourceFile));
     }
     return true;
   }
@@ -1198,9 +1200,10 @@ bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
   if (!MocConst().PredefsFileAbs.empty()) {
     if (outputFileTime.Older(MocEval().PredefsTime)) {
       if (reason != nullptr) {
-        *reason = cmStrCat(
-          "Generating ", Quoted(outputFile), ", because it's older than ",
-          Quoted(MocConst().PredefsFileAbs), ", from ", Quoted(sourceFile));
+        *reason = cmStrCat("Generating ", MessagePath(outputFile),
+                           ", because it's older than ",
+                           MessagePath(MocConst().PredefsFileAbs), ", from ",
+                           MessagePath(sourceFile));
       }
       return true;
     }
@@ -1209,9 +1212,9 @@ bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
   // Test if the moc executable is newer
   if (outputFileTime.Older(MocConst().ExecutableTime)) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(outputFile),
+      *reason = cmStrCat("Generating ", MessagePath(outputFile),
                          ", because it's older than the moc executable, from ",
-                         Quoted(sourceFile));
+                         MessagePath(sourceFile));
     }
     return true;
   }
@@ -1224,17 +1227,19 @@ bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
       // Find dependency file
       auto const depMatch = FindDependency(sourceDir, dep);
       if (depMatch.first.empty()) {
-        Log().WarningFile(GenT::MOC, sourceFile,
-                          "Could not find dependency file " + Quoted(dep));
+        Log().Warning(GenT::MOC,
+                      cmStrCat(MessagePath(sourceFile), " depends on ",
+                               MessagePath(dep),
+                               " but the file does not exist."));
         continue;
       }
       // Test if dependency file is older
       if (outputFileTime.Older(depMatch.second)) {
         if (reason != nullptr) {
-          *reason =
-            cmStrCat("Generating ", Quoted(outputFile),
-                     ", because it's older than its dependency file ",
-                     Quoted(depMatch.first), ", from ", Quoted(sourceFile));
+          *reason = cmStrCat("Generating ", MessagePath(outputFile),
+                             ", because it's older than its dependency file ",
+                             MessagePath(depMatch.first), ", from ",
+                             MessagePath(sourceFile));
         }
         return true;
       }
@@ -1297,8 +1302,8 @@ bool cmQtAutoMocUic::JobProbeDepsUicT::Probe(MappingT const& mapping,
   if (!outputFileTime.Load(outputFile)) {
     if (reason != nullptr) {
       *reason =
-        cmStrCat("Generating ", Quoted(outputFile),
-                 ", because it doesn't exist, from ", Quoted(sourceFile));
+        cmStrCat("Generating ", MessagePath(outputFile),
+                 ", because it doesn't exist, from ", MessagePath(sourceFile));
     }
     return true;
   }
@@ -1306,9 +1311,9 @@ bool cmQtAutoMocUic::JobProbeDepsUicT::Probe(MappingT const& mapping,
   // Test if the uic settings changed
   if (UicConst().SettingsChanged) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(outputFile),
+      *reason = cmStrCat("Generating ", MessagePath(outputFile),
                          ", because the uic settings changed, from ",
-                         Quoted(sourceFile));
+                         MessagePath(sourceFile));
     }
     return true;
   }
@@ -1316,9 +1321,9 @@ bool cmQtAutoMocUic::JobProbeDepsUicT::Probe(MappingT const& mapping,
   // Test if the source file is newer
   if (outputFileTime.Older(mapping.SourceFile->FileTime)) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(outputFile),
+      *reason = cmStrCat("Generating ", MessagePath(outputFile),
                          " because it's older than the source file ",
-                         Quoted(sourceFile));
+                         MessagePath(sourceFile));
     }
     return true;
   }
@@ -1326,9 +1331,9 @@ bool cmQtAutoMocUic::JobProbeDepsUicT::Probe(MappingT const& mapping,
   // Test if the uic executable is newer
   if (outputFileTime.Older(UicConst().ExecutableTime)) {
     if (reason != nullptr) {
-      *reason = cmStrCat("Generating ", Quoted(outputFile),
+      *reason = cmStrCat("Generating ", MessagePath(outputFile),
                          ", because it's older than the uic executable, from ",
-                         Quoted(sourceFile));
+                         MessagePath(sourceFile));
     }
     return true;
   }
@@ -1344,7 +1349,9 @@ void cmQtAutoMocUic::JobProbeDepsFinishT::Process()
     auto createDirs = [this](GenT genType, StringSet const& dirSet) {
       for (std::string const& dirName : dirSet) {
         if (!cmSystemTools::MakeDirectory(dirName)) {
-          this->LogFileError(genType, dirName, "Could not create directory.");
+          this->LogError(
+            genType,
+            cmStrCat("Creating directory ", MessagePath(dirName), " failed."));
           return;
         }
       }
@@ -1402,13 +1409,13 @@ void cmQtAutoMocUic::JobCompileMocT::Process()
     if (!Mapping->IncluderFiles.empty()) {
       includers = "included by\n";
       for (auto const& item : Mapping->IncluderFiles) {
-        includers += cmStrCat("  ", Quoted(item->FileName), '\n');
+        includers += cmStrCat("  ", MessagePath(item->FileName), '\n');
       }
     }
     LogCommandError(GenT::MOC,
                     cmStrCat("The moc process failed to compile\n  ",
-                             Quoted(sourceFile), "\ninto\n  ",
-                             Quoted(outputFile), '\n', includers,
+                             MessagePath(sourceFile), "\ninto\n  ",
+                             MessagePath(outputFile), '\n', includers,
                              result.ErrorMessage),
                     cmd, result.StdOut);
   }
@@ -1446,13 +1453,13 @@ void cmQtAutoMocUic::JobCompileUicT::Process()
     // Uic command failed
     std::string includers;
     for (auto const& item : Mapping->IncluderFiles) {
-      includers += cmStrCat("  ", Quoted(item->FileName), '\n');
+      includers += cmStrCat("  ", MessagePath(item->FileName), '\n');
     }
     LogCommandError(GenT::UIC,
                     cmStrCat("The uic process failed to compile\n  ",
-                             Quoted(sourceFile), "\ninto\n  ",
-                             Quoted(outputFile), "\nincluded by\n", includers,
-                             result.ErrorMessage),
+                             MessagePath(sourceFile), "\ninto\n  ",
+                             MessagePath(outputFile), "\nincluded by\n",
+                             includers, result.ErrorMessage),
                     cmd, result.StdOut);
   }
 }
@@ -1480,20 +1487,24 @@ void cmQtAutoMocUic::JobMocsCompilationT::Process()
   if (cmQtAutoGenerator::FileDiffers(compAbs, content)) {
     // Actually write mocs compilation file
     if (Log().Verbose()) {
-      Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs);
+      Log().Info(GenT::MOC,
+                 "Generating MOC compilation " + MessagePath(compAbs));
     }
     if (!FileWrite(compAbs, content)) {
-      LogFileError(GenT::MOC, compAbs,
-                   "mocs compilation file writing failed.");
+      LogError(GenT::MOC,
+               cmStrCat("Writing MOC compilation ", MessagePath(compAbs),
+                        " failed."));
     }
   } else if (MocEval().CompUpdated) {
     // Only touch mocs compilation file
     if (Log().Verbose()) {
-      Log().Info(GenT::MOC, "Touching mocs compilation " + compAbs);
+      Log().Info(GenT::MOC,
+                 "Touching MOC compilation " + MessagePath(compAbs));
     }
     if (!cmSystemTools::Touch(compAbs, false)) {
-      LogFileError(GenT::MOC, compAbs,
-                   "mocs compilation file touching failed.");
+      LogError(GenT::MOC,
+               cmStrCat("Touching MOC compilation ", MessagePath(compAbs),
+                        " failed."));
     }
   }
 }
@@ -1587,10 +1598,10 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     makefile->GetCMakeInstance()->GetHeaderExtensions();
 
   // - Files and directories
-  BaseConst_.ProjectSourceDir = InfoGet("AM_CMAKE_SOURCE_DIR");
-  BaseConst_.ProjectBinaryDir = InfoGet("AM_CMAKE_BINARY_DIR");
-  BaseConst_.CurrentSourceDir = InfoGet("AM_CMAKE_CURRENT_SOURCE_DIR");
-  BaseConst_.CurrentBinaryDir = InfoGet("AM_CMAKE_CURRENT_BINARY_DIR");
+  ProjectDirsRef().Source = InfoGet("AM_CMAKE_SOURCE_DIR");
+  ProjectDirsRef().Binary = InfoGet("AM_CMAKE_BINARY_DIR");
+  ProjectDirsRef().CurrentSource = InfoGet("AM_CMAKE_CURRENT_SOURCE_DIR");
+  ProjectDirsRef().CurrentBinary = InfoGet("AM_CMAKE_CURRENT_BINARY_DIR");
   BaseConst_.AutogenBuildDir = InfoGet("AM_BUILD_DIR");
   if (BaseConst_.AutogenBuildDir.empty()) {
     return LogInfoError("Autogen build directory missing.");
@@ -1605,7 +1616,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
   }
   if (!BaseConst_.CMakeExecutableTime.Load(BaseConst_.CMakeExecutable)) {
     return LogInfoError(cmStrCat("The CMake executable ",
-                                 Quoted(BaseConst_.CMakeExecutable),
+                                 MessagePath(BaseConst_.CMakeExecutable),
                                  " does not exist."));
   }
   BaseConst_.ParseCacheFile = InfoGetConfig("AM_PARSE_CACHE_FILE");
@@ -1634,7 +1645,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     // Load the executable file time
     if (!MocConst_.ExecutableTime.Load(MocConst_.Executable)) {
       return LogInfoError(cmStrCat("The moc executable ",
-                                   Quoted(MocConst_.Executable),
+                                   MessagePath(MocConst_.Executable),
                                    " does not exist."));
     }
     for (std::string& sfl : InfoGetList("AM_MOC_SKIP")) {
@@ -1700,7 +1711,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     // Load the executable file time
     if (!UicConst_.ExecutableTime.Load(UicConst_.Executable)) {
       return LogInfoError(cmStrCat("The uic executable ",
-                                   Quoted(UicConst_.Executable),
+                                   MessagePath(UicConst_.Executable),
                                    " does not exist."));
     }
     for (std::string& sfl : InfoGetList("AM_UIC_SKIP")) {
@@ -1729,17 +1740,17 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
 
   // - Headers and sources
   {
-    auto makeSource =
-      [&LogInfoError](std::string const& fileName,
-                      std::string const& fileFlags) -> SourceFileHandleT {
+    auto makeSource = [this, &LogInfoError](
+                        std::string const& fileName,
+                        std::string const& fileFlags) -> SourceFileHandleT {
       if (fileFlags.size() != 2) {
         LogInfoError("Invalid file flags string size");
         return SourceFileHandleT();
       }
       cmFileTime fileTime;
       if (!fileTime.Load(fileName)) {
-        LogInfoError("The source file " + cmQtAutoGen::Quoted(fileName) +
-                     " does not exist.");
+        LogInfoError(cmStrCat("The source file ", this->MessagePath(fileName),
+                              " does not exist."));
         return SourceFileHandleT();
       }
       SourceFileHandleT sfh = std::make_shared<SourceFileT>(fileName);
@@ -1777,9 +1788,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
         if (MocConst().Enabled) {
           sfh->BuildPath = std::move(builds[ii]);
           if (sfh->BuildPath.empty()) {
-            Log().ErrorFile(GenT::GEN, this->InfoFile(),
-                            "Header file build path is empty");
-            return false;
+            return LogInfoError("Header file build path is empty");
           }
         }
         BaseEval().Headers.emplace(std::move(fileName), std::move(sfh));
@@ -1817,13 +1826,13 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
 
     // Moc predefs file
     if (!MocConst_.PredefsCmd.empty()) {
+      std::string pathRel;
       if (BaseConst_.MultiConfig) {
-        MocConst_.PredefsFileRel =
-          cmStrCat("moc_predefs_", InfoConfig(), ".h");
+        pathRel = cmStrCat("moc_predefs_", InfoConfig(), ".h");
       } else {
-        MocConst_.PredefsFileRel = "moc_predefs.h";
+        pathRel = "moc_predefs.h";
       }
-      MocConst_.PredefsFileAbs = AbsoluteBuildPath(MocConst().PredefsFileRel);
+      MocConst_.PredefsFileAbs = AbsoluteBuildPath(pathRel);
     }
 
     // Compose moc includes list
@@ -1887,7 +1896,7 @@ void cmQtAutoMocUic::CreateParseJobs(SourceFileMapT const& sourceMap)
 std::string cmQtAutoMocUic::CollapseFullPathTS(std::string const& path) const
 {
   std::lock_guard<std::mutex> guard(CMakeLibMutex_);
-  return cmSystemTools::CollapseFullPath(path, BaseConst().CurrentSourceDir);
+  return cmSystemTools::CollapseFullPath(path, ProjectDirs().CurrentSource);
 }
 
 void cmQtAutoMocUic::InitJobs()
@@ -2016,7 +2025,9 @@ bool cmQtAutoMocUic::SettingsFileWrite()
   // Only write if any setting changed
   if (MocConst().SettingsChanged || UicConst().SettingsChanged) {
     if (Log().Verbose()) {
-      Log().Info(GenT::GEN, "Writing settings file " + Quoted(SettingsFile_));
+      Log().Info(
+        GenT::GEN,
+        cmStrCat("Writing settings file ", MessagePath(SettingsFile_)));
     }
     // Compose settings file content
     std::string content;
@@ -2033,8 +2044,9 @@ bool cmQtAutoMocUic::SettingsFileWrite()
     // Write settings file
     std::string error;
     if (!cmQtAutoGenerator::FileWrite(SettingsFile_, content, &error)) {
-      Log().ErrorFile(GenT::GEN, SettingsFile_,
-                      "Settings file writing failed. " + error);
+      Log().Error(GenT::GEN,
+                  cmStrCat("Writing the settings file ",
+                           MessagePath(SettingsFile_), " failed.\n", error));
       // Remove old settings file to trigger a full rebuild on the next run
       cmSystemTools::RemoveFile(SettingsFile_);
       return false;
@@ -2074,12 +2086,14 @@ bool cmQtAutoMocUic::ParseCacheWrite()
   if (BaseEval().ParseCacheChanged) {
     if (Log().Verbose()) {
       Log().Info(GenT::GEN,
-                 "Writing parse cache file " +
-                   Quoted(BaseConst().ParseCacheFile));
+                 cmStrCat("Writing the parse cache file ",
+                          MessagePath(BaseConst().ParseCacheFile)));
     }
     if (!BaseEval().ParseCache.WriteToFile(BaseConst().ParseCacheFile)) {
-      Log().ErrorFile(GenT::GEN, BaseConst().ParseCacheFile,
-                      "Parse cache file writing failed.");
+      Log().Error(GenT::GEN,
+                  cmStrCat("Writing the parse cache file ",
+                           MessagePath(BaseConst().ParseCacheFile),
+                           " failed."));
       return false;
     }
   }
@@ -2090,8 +2104,10 @@ bool cmQtAutoMocUic::CreateDirectories()
 {
   // Create AUTOGEN include directory
   if (!cmSystemTools::MakeDirectory(BaseConst().AutogenIncludeDir)) {
-    Log().ErrorFile(GenT::GEN, BaseConst().AutogenIncludeDir,
-                    "Could not create directory.");
+    Log().Error(GenT::GEN,
+                cmStrCat("Creating the AUTOGEN include directory ",
+                         MessagePath(BaseConst().AutogenIncludeDir),
+                         " failed."));
     return false;
   }
   return true;
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index e480751..d77e774 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -169,10 +169,6 @@ public:
     bool MultiConfig = false;
     unsigned int QtVersionMajor = 4;
     // - Directories
-    std::string ProjectSourceDir;
-    std::string ProjectBinaryDir;
-    std::string CurrentSourceDir;
-    std::string CurrentBinaryDir;
     std::string AutogenBuildDir;
     std::string AutogenIncludeDir;
     // - Files
@@ -218,7 +214,6 @@ public:
     cmFileTime ExecutableTime;
     std::string Executable;
     std::string CompFileAbs;
-    std::string PredefsFileRel;
     std::string PredefsFileAbs;
     std::unordered_set<std::string> SkipList;
     std::vector<std::string> IncludePaths;
@@ -313,10 +308,13 @@ public:
     UicSettingsT const& UicConst() const { return Gen()->UicConst(); }
     UicEvalT& UicEval() const { return Gen()->UicEval(); }
 
-    // -- Error logging with automatic abort
+    // -- Logging
+    std::string MessagePath(cm::string_view path) const
+    {
+      return Gen()->MessagePath(path);
+    }
+    // - Error logging with automatic abort
     void LogError(GenT genType, cm::string_view message) const;
-    void LogFileError(GenT genType, cm::string_view filename,
-                      cm::string_view message) const;
     void LogCommandError(GenT genType, cm::string_view message,
                          std::vector<std::string> const& command,
                          std::string const& output) const;
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
index e931346..cd3e034 100644
--- a/Source/cmQtAutoRcc.cxx
+++ b/Source/cmQtAutoRcc.cxx
@@ -16,7 +16,6 @@
 #include <algorithm>
 
 cmQtAutoRcc::cmQtAutoRcc() = default;
-
 cmQtAutoRcc::~cmQtAutoRcc() = default;
 
 bool cmQtAutoRcc::Init(cmMakefile* makefile)
@@ -41,8 +40,8 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
     return cmExpandedList(InfoGetConfig(key));
   };
   auto LogInfoError = [this](cm::string_view msg) -> bool {
-    this->Log().Error(GenT::RCC,
-                      cmStrCat("In ", Quoted(this->InfoFile()), ":\n", msg));
+    this->Log().Error(
+      GenT::RCC, cmStrCat("In ", MessagePath(this->InfoFile()), ":\n", msg));
     return false;
   };
 
@@ -56,6 +55,8 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
   MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG");
 
   // - Directories
+  ProjectDirsRef().Source = InfoGet("ARCC_CMAKE_SOURCE_DIR");
+  ProjectDirsRef().Binary = InfoGet("ARCC_CMAKE_BINARY_DIR");
   AutogenBuildDir_ = InfoGet("ARCC_BUILD_DIR");
   if (AutogenBuildDir_.empty()) {
     return LogInfoError("Build directory empty.");
@@ -69,8 +70,8 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
   // - Rcc executable
   RccExecutable_ = InfoGet("ARCC_RCC_EXECUTABLE");
   if (!RccExecutableTime_.Load(RccExecutable_)) {
-    return LogInfoError(cmStrCat("The rcc executable ", Quoted(RccExecutable_),
-                                 " does not exist."));
+    return LogInfoError(cmStrCat(
+      "The rcc executable ", MessagePath(RccExecutable_), " does not exist."));
   }
   RccListOptions_ = InfoGetList("ARCC_RCC_LIST_OPTIONS");
 
@@ -185,8 +186,9 @@ bool cmQtAutoRcc::SettingsFileRead()
   if (!cmSystemTools::FileExists(SettingsFile_, true)) {
     // Touch the settings file to make sure it exists
     if (!cmSystemTools::Touch(SettingsFile_, true)) {
-      Log().ErrorFile(GenT::RCC, SettingsFile_,
-                      "Settings file creation failed.");
+      Log().Error(GenT::RCC,
+                  cmStrCat("Touching the settings file ",
+                           MessagePath(SettingsFile_), " failed."));
       return false;
     }
   }
@@ -196,7 +198,9 @@ bool cmQtAutoRcc::SettingsFileRead()
     // Make sure the lock file exists
     if (!cmSystemTools::FileExists(LockFile_, true)) {
       if (!cmSystemTools::Touch(LockFile_, true)) {
-        Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed.");
+        Log().Error(GenT::RCC,
+                    cmStrCat("Touching the lock file ", MessagePath(LockFile_),
+                             " failed."));
         return false;
       }
     }
@@ -204,8 +208,9 @@ bool cmQtAutoRcc::SettingsFileRead()
     cmFileLockResult lockResult =
       LockFileLock_.Lock(LockFile_, static_cast<unsigned long>(-1));
     if (!lockResult.IsOk()) {
-      Log().ErrorFile(GenT::RCC, LockFile_,
-                      "File lock failed: " + lockResult.GetOutputMessage());
+      Log().Error(GenT::RCC,
+                  cmStrCat("Locking of the lock file ", MessagePath(LockFile_),
+                           " failed.\n", lockResult.GetOutputMessage()));
       return false;
     }
   }
@@ -221,8 +226,10 @@ bool cmQtAutoRcc::SettingsFileRead()
       if (SettingsChanged_) {
         std::string error;
         if (!FileWrite(SettingsFile_, "", &error)) {
-          Log().ErrorFile(GenT::RCC, SettingsFile_,
-                          "Settings file clearing failed. " + error);
+          Log().Error(GenT::RCC,
+                      cmStrCat("Clearing of the settings file ",
+                               MessagePath(SettingsFile_), " failed.\n",
+                               error));
           return false;
         }
       }
@@ -239,14 +246,16 @@ bool cmQtAutoRcc::SettingsFileWrite()
   // Only write if any setting changed
   if (SettingsChanged_) {
     if (Log().Verbose()) {
-      Log().Info(GenT::RCC, "Writing settings file " + Quoted(SettingsFile_));
+      Log().Info(GenT::RCC,
+                 "Writing settings file " + MessagePath(SettingsFile_));
     }
     // Write settings file
     std::string content = cmStrCat("rcc:", SettingsString_, '\n');
     std::string error;
     if (!FileWrite(SettingsFile_, content, &error)) {
-      Log().ErrorFile(GenT::RCC, SettingsFile_,
-                      "Settings file writing failed. " + error);
+      Log().Error(GenT::RCC,
+                  cmStrCat("Writing of the settings file ",
+                           MessagePath(SettingsFile_), " failed.\n", error));
       // Remove old settings file to trigger a full rebuild on the next run
       cmSystemTools::RemoveFile(SettingsFile_);
       return false;
@@ -263,17 +272,18 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
 {
   // Test if the rcc input file exists
   if (!QrcFileTime_.Load(QrcFile_)) {
-    Log().ErrorFile(
-      GenT::RCC, QrcFile_,
-      cmStrCat("The resources file ", Quoted(QrcFile_), " does not exist"));
+    Log().Error(GenT::RCC,
+                cmStrCat("The resources file ", MessagePath(QrcFile_),
+                         " does not exist"));
     return false;
   }
 
   // Test if the rcc output file exists
   if (!RccFileTime_.Load(RccFileOutput_)) {
     if (Log().Verbose()) {
-      Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
-                        ", because it doesn't exist, from ", Quoted(QrcFile_));
+      Reason =
+        cmStrCat("Generating ", MessagePath(RccFileOutput_),
+                 ", because it doesn't exist, from ", MessagePath(QrcFile_));
     }
     generate = true;
     return true;
@@ -282,9 +292,9 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
   // Test if the settings changed
   if (SettingsChanged_) {
     if (Log().Verbose()) {
-      Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+      Reason = cmStrCat("Generating ", MessagePath(RccFileOutput_),
                         ", because the rcc settings changed, from ",
-                        Quoted(QrcFile_));
+                        MessagePath(QrcFile_));
     }
     generate = true;
     return true;
@@ -293,9 +303,9 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
   // Test if the rcc output file is older than the .qrc file
   if (RccFileTime_.Older(QrcFileTime_)) {
     if (Log().Verbose()) {
-      Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
-                        ", because it is older than ", Quoted(QrcFile_),
-                        ", from ", Quoted(QrcFile_));
+      Reason = cmStrCat("Generating ", MessagePath(RccFileOutput_),
+                        ", because it is older than ", MessagePath(QrcFile_),
+                        ", from ", MessagePath(QrcFile_));
     }
     generate = true;
     return true;
@@ -304,9 +314,9 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
   // Test if the rcc output file is older than the rcc executable
   if (RccFileTime_.Older(RccExecutableTime_)) {
     if (Log().Verbose()) {
-      Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+      Reason = cmStrCat("Generating ", MessagePath(RccFileOutput_),
                         ", because it is older than the rcc executable, from ",
-                        Quoted(QrcFile_));
+                        MessagePath(QrcFile_));
     }
     generate = true;
     return true;
@@ -322,7 +332,9 @@ bool cmQtAutoRcc::TestResources(bool& generate)
     std::string error;
     RccLister const lister(RccExecutable_, RccListOptions_);
     if (!lister.list(QrcFile_, Inputs_, error, Log().Verbose())) {
-      Log().ErrorFile(GenT::RCC, QrcFile_, error);
+      Log().Error(
+        GenT::RCC,
+        cmStrCat("Listing of ", MessagePath(QrcFile_), " failed.\n", error));
       return false;
     }
   }
@@ -332,17 +344,18 @@ bool cmQtAutoRcc::TestResources(bool& generate)
     // Check if the resource file exists
     cmFileTime fileTime;
     if (!fileTime.Load(resFile)) {
-      Log().ErrorFile(GenT::RCC, QrcFile_,
-                      cmStrCat("Could not find the resource file\n  ",
-                               Quoted(resFile), '\n'));
+      Log().Error(GenT::RCC,
+                  cmStrCat("The resource file ", MessagePath(resFile),
+                           " listed in ", MessagePath(QrcFile_),
+                           " does not exist."));
       return false;
     }
     // Check if the resource file is newer than the rcc output file
     if (RccFileTime_.Older(fileTime)) {
       if (Log().Verbose()) {
-        Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
-                          ", because it is older than ", Quoted(resFile),
-                          ", from ", Quoted(QrcFile_));
+        Reason = cmStrCat("Generating ", MessagePath(RccFileOutput_),
+                          ", because it is older than ", MessagePath(resFile),
+                          ", from ", MessagePath(QrcFile_));
       }
       generate = true;
       break;
@@ -357,12 +370,15 @@ bool cmQtAutoRcc::TestInfoFile()
   if (RccFileTime_.Older(InfoFileTime())) {
     if (Log().Verbose()) {
       Log().Info(GenT::RCC,
-                 cmStrCat("Touching ", Quoted(RccFileOutput_),
-                          " because it is older than ", Quoted(InfoFile())));
+                 cmStrCat("Touching ", MessagePath(RccFileOutput_),
+                          " because it is older than ",
+                          MessagePath(InfoFile())));
     }
     // Touch build file
     if (!cmSystemTools::Touch(RccFileOutput_, false)) {
-      Log().ErrorFile(GenT::RCC, RccFileOutput_, "Build file touch failed");
+      Log().Error(
+        GenT::RCC,
+        cmStrCat("Touching ", MessagePath(RccFileOutput_), " failed."));
       return false;
     }
     BuildFileChanged_ = true;
@@ -375,8 +391,9 @@ bool cmQtAutoRcc::GenerateRcc()
 {
   // Make parent directory
   if (!MakeParentDirectory(RccFileOutput_)) {
-    Log().ErrorFile(GenT::RCC, RccFileOutput_,
-                    "Could not create parent directory");
+    Log().Error(GenT::RCC,
+                cmStrCat("Could not create parent directory of ",
+                         MessagePath(RccFileOutput_)));
     return false;
   }
 
@@ -405,8 +422,8 @@ bool cmQtAutoRcc::GenerateRcc()
     // rcc process failed
     Log().ErrorCommand(GenT::RCC,
                        cmStrCat("The rcc process failed to compile\n  ",
-                                Quoted(QrcFile_), "\ninto\n  ",
-                                Quoted(RccFileOutput_)),
+                                MessagePath(QrcFile_), "\ninto\n  ",
+                                MessagePath(RccFileOutput_)),
                        cmd, rccStdOut + rccStdErr);
     cmSystemTools::RemoveFile(RccFileOutput_);
     return false;
@@ -443,22 +460,29 @@ bool cmQtAutoRcc::GenerateWrapper()
     if (fileDiffers) {
       // Write new wrapper file
       if (Log().Verbose()) {
-        Log().Info(GenT::RCC, "Generating RCC wrapper file " + RccFilePublic_);
+        Log().Info(GenT::RCC,
+                   cmStrCat("Generating RCC wrapper file ",
+                            MessagePath(RccFilePublic_)));
       }
       std::string error;
       if (!FileWrite(RccFilePublic_, content, &error)) {
-        Log().ErrorFile(GenT::RCC, RccFilePublic_,
-                        "RCC wrapper file writing failed. " + error);
+        Log().Error(GenT::RCC,
+                    cmStrCat("Generating RCC wrapper file ",
+                             MessagePath(RccFilePublic_), " failed.\n",
+                             error));
         return false;
       }
     } else if (BuildFileChanged_) {
       // Just touch the wrapper file
       if (Log().Verbose()) {
-        Log().Info(GenT::RCC, "Touching RCC wrapper file " + RccFilePublic_);
+        Log().Info(
+          GenT::RCC,
+          cmStrCat("Touching RCC wrapper file ", MessagePath(RccFilePublic_)));
       }
       if (!cmSystemTools::Touch(RccFilePublic_, false)) {
-        Log().ErrorFile(GenT::RCC, RccFilePublic_,
-                        "RCC wrapper file touch failed.");
+        Log().Error(GenT::RCC,
+                    cmStrCat("Touching RCC wrapper file ",
+                             MessagePath(RccFilePublic_), " failed."));
         return false;
       }
     }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51676cf65590f7a9bc3ad247151ee5bdc768eb77
commit 51676cf65590f7a9bc3ad247151ee5bdc768eb77
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 13:00:59 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Split JobEvalCacheT job into separate moc and uic jobs
    
    This splits the `JobEvalCacheT` job into separate `JobEvalCacheMocT` and
    `JobEvalCacheUicT` classes, that run concurrently.
    The `JobEvalCache*T::FindIncluded*` methods are overhauled to store probed
    directoriy names only if probing fails.  Warning messages are refactored
    to show the file name and the probed directories instead of all probed file
    paths.  This is easier to read.

diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 6265777..7b65429 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -551,49 +551,35 @@ void cmQtAutoMocUic::JobParseSourceT::Process()
   }
 }
 
-void cmQtAutoMocUic::JobEvalCacheT::Process()
+std::string cmQtAutoMocUic::JobEvalCacheT::MessageSearchLocations() const
 {
-  // Evaluate for moc
-  if (MocConst().Enabled) {
-    // Evaluate headers
-    for (auto const& pair : BaseEval().Headers) {
-      if (!MocEvalHeader(pair.second)) {
-        return;
-      }
-    }
-    // Evaluate sources
-    for (auto const& pair : BaseEval().Sources) {
-      if (!MocEvalSource(pair.second)) {
-        return;
-      }
-    }
+  std::string res;
+  res.reserve(512);
+  for (std::string const& path : SearchLocations) {
+    res += "  ";
+    res += Quoted(path);
+    res += '\n';
   }
-  // Evaluate for uic
-  if (UicConst().Enabled) {
-    if (!UicEval(BaseEval().Headers) || !UicEval(BaseEval().Sources)) {
+  return res;
+}
+
+void cmQtAutoMocUic::JobEvalCacheMocT::Process()
+{
+  // Evaluate headers
+  for (auto const& pair : BaseEval().Headers) {
+    if (!EvalHeader(pair.second)) {
       return;
     }
   }
-
-  // Add discovered header parse jobs
-  Gen()->CreateParseJobs<JobParseHeaderT>(MocEval().HeadersDiscovered);
-
-  // Add dependency probing jobs
-  {
-    // Add fence job to ensure all parsing has finished
-    Gen()->WorkerPool().EmplaceJob<JobFenceT>();
-    if (MocConst().Enabled) {
-      Gen()->WorkerPool().EmplaceJob<JobProbeDepsMocT>();
-    }
-    if (UicConst().Enabled) {
-      Gen()->WorkerPool().EmplaceJob<JobProbeDepsUicT>();
+  // Evaluate sources
+  for (auto const& pair : BaseEval().Sources) {
+    if (!EvalSource(pair.second)) {
+      return;
     }
-    // Add probe finish job
-    Gen()->WorkerPool().EmplaceJob<JobProbeDepsFinishT>();
   }
 }
 
-bool cmQtAutoMocUic::JobEvalCacheT::MocEvalHeader(SourceFileHandleT source)
+bool cmQtAutoMocUic::JobEvalCacheMocT::EvalHeader(SourceFileHandleT source)
 {
   SourceFileT const& sourceFile = *source;
   auto const& parseData = sourceFile.ParseData->Moc;
@@ -614,13 +600,13 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalHeader(SourceFileHandleT source)
     }
 
     // Register mapping in headers map
-    MocRegisterMapping(handle, true);
+    RegisterMapping(handle, true);
   }
 
   return true;
 }
 
-bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
+bool cmQtAutoMocUic::JobEvalCacheMocT::EvalSource(
   SourceFileHandleT const& source)
 {
   SourceFileT const& sourceFile = *source;
@@ -631,7 +617,7 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
     return true;
   }
 
-  std::string const sourceDir = SubDirPrefix(sourceFile.FileName);
+  std::string const sourceDirPrefix = SubDirPrefix(sourceFile.FileName);
   std::string const sourceBase =
     cmSystemTools::GetFilenameWithoutLastExtension(sourceFile.FileName);
 
@@ -658,27 +644,30 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
   // Check if this source needs to be moc processed but doesn't.
   if (!sourceIncludesDotMoc && !parseData.Macro.empty() &&
       !(relaxedMode && sourceIncludesMocUnderscore)) {
-    LogFileError(GenT::MOC, sourceFile.FileName,
-                 cmStrCat("The file contains a ", Quoted(parseData.Macro),
-                          " macro, but does not include ",
-                          Quoted(sourceBase + ".moc"),
-                          "!\nConsider to\n  - add #include \"", sourceBase,
-                          ".moc\"\n  - enable SKIP_AUTOMOC for this file"));
+    LogError(GenT::MOC,
+             cmStrCat(sourceFile.FileName, "\ncontains a ",
+                      Quoted(parseData.Macro), " macro, but does not include ",
+                      Quoted(sourceBase + ".moc"),
+                      "!\nConsider to\n  - add #include \"", sourceBase,
+                      ".moc\"\n  - enable SKIP_AUTOMOC for this file"));
     return false;
   }
 
   // Evaluate "moc_" includes
   for (IncludeKeyT const& incKey : parseData.Include.Underscore) {
-    std::string const headerBase = incKey.Dir + incKey.Base;
-    SourceFileHandleT header = MocFindIncludedHeader(sourceDir, headerBase);
-    if (!header) {
-      LogFileError(GenT::MOC, sourceFile.FileName,
-                   cmStrCat("The file includes the moc file ",
-                            Quoted(incKey.Key),
-                            ",\nbut the header could not be found "
-                            "in the following locations\n",
-                            MocMessageTestHeaders(headerBase)));
-      return false;
+    SourceFileHandleT headerHandle;
+    {
+      std::string const headerBase = cmStrCat(incKey.Dir, incKey.Base);
+      if (!FindIncludedHeader(headerHandle, sourceDirPrefix, headerBase)) {
+        LogError(GenT::MOC,
+                 cmStrCat(Quoted(sourceFile.FileName),
+                          "\nincludes the moc file ", Quoted(incKey.Key),
+                          ",\nbut a header ", MessageHeader(headerBase),
+                          "\ncould not be found "
+                          "in the following directories\n",
+                          MessageSearchLocations()));
+        return false;
+      }
     }
     // The include might be handled differently in relaxed mode
     if (relaxedMode && !sourceIncludesDotMoc && !parseData.Macro.empty() &&
@@ -690,9 +679,9 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
       // used. This is for KDE4 compatibility.
 
       // Issue a warning
-      Log().WarningFile(
-        GenT::MOC, sourceFile.FileName,
-        cmStrCat("The file contains a ", Quoted(parseData.Macro),
+      Log().Warning(
+        GenT::MOC,
+        cmStrCat(sourceFile.FileName, "\ncontains a ", Quoted(parseData.Macro),
                  " macro, but does not include ", Quoted(sourceBase + ".moc"),
                  ".\nInstead it includes ", Quoted(incKey.Key),
                  ".\nRunning moc on the source\n  ",
@@ -702,18 +691,18 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
                  "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
 
       // Create mapping
-      if (!MocRegisterIncluded(incKey.Key, source, source, false)) {
+      if (!RegisterIncluded(incKey.Key, source, source, false)) {
         return false;
       }
       continue;
     }
 
     // Check if header is skipped
-    if (MocConst().skipped(header->FileName)) {
+    if (MocConst().skipped(headerHandle->FileName)) {
       continue;
     }
     // Create mapping
-    if (!MocRegisterIncluded(incKey.Key, source, std::move(header), true)) {
+    if (!RegisterIncluded(incKey.Key, source, std::move(headerHandle), true)) {
       return false;
     }
   }
@@ -726,53 +715,61 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
       bool const ownMoc = (incKey.Base == sourceBase);
       if (ownMoc && !parseData.Macro.empty()) {
         // Create mapping for the regular use case
-        if (!MocRegisterIncluded(incKey.Key, source, source, false)) {
+        if (!RegisterIncluded(incKey.Key, source, source, false)) {
           return false;
         }
         continue;
       }
       // Try to find a header instead but issue a warning.
       // This is for KDE4 compatibility.
-      std::string const headerBase = incKey.Dir + incKey.Base;
-      SourceFileHandleT header = MocFindIncludedHeader(sourceDir, headerBase);
-      if (!header) {
-        LogFileError(
-          GenT::MOC, sourceFile.FileName,
-          cmStrCat("The file includes the moc file ", Quoted(incKey.Key),
-                   ",\nwhich seems to be the moc file from a different source "
-                   "file.\nCMAKE_AUTOMOC_RELAXED_MODE: Also a matching header"
-                   "could not be found in the following locations\n",
-                   MocMessageTestHeaders(headerBase)));
-        return false;
+      SourceFileHandleT headerHandle;
+      {
+        std::string const headerBase = cmStrCat(incKey.Dir, incKey.Base);
+        if (!FindIncludedHeader(headerHandle, sourceDirPrefix, headerBase)) {
+          LogError(
+            GenT::MOC,
+            cmStrCat(
+              Quoted(sourceFile.FileName), "\nincludes the moc file ",
+              Quoted(incKey.Key),
+              ",\nwhich seems to be the moc file from a different source "
+              "file.\nCMAKE_AUTOMOC_RELAXED_MODE:\nAlso a matching header ",
+              MessageHeader(headerBase),
+              "\ncould not be found in the following directories\n",
+              MessageSearchLocations()));
+          return false;
+        }
       }
       // Check if header is skipped
-      if (MocConst().skipped(header->FileName)) {
+      if (MocConst().skipped(headerHandle->FileName)) {
         continue;
       }
       // Issue a warning
       if (ownMoc && parseData.Macro.empty()) {
-        Log().WarningFile(
-          GenT::MOC, sourceFile.FileName,
-          cmStrCat("The file includes the moc file ", Quoted(incKey.Key),
-                   ", but does not contain a\n", MocConst().MacrosString(),
+        Log().Warning(
+          GenT::MOC,
+          cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
+                   Quoted(incKey.Key), ", but does not contain a\n",
+                   MocConst().MacrosString(),
                    " macro.\nRunning moc on the header\n  ",
-                   Quoted(header->FileName), "!\nBetter include ",
+                   Quoted(headerHandle->FileName), "!\nBetter include ",
                    Quoted("moc_" + incKey.Base + ".cpp"),
                    " for a compatibility with regular mode.\n",
                    "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
       } else {
-        Log().WarningFile(
-          GenT::MOC, sourceFile.FileName,
-          cmStrCat("The file includes the moc file ", Quoted(incKey.Key),
-                   " instead of ", Quoted("moc_" + incKey.Base + ".cpp"),
+        Log().Warning(
+          GenT::MOC,
+          cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
+                   Quoted(incKey.Key), " instead of ",
+                   Quoted("moc_" + incKey.Base + ".cpp"),
                    ".\nRunning moc on the header\n  ",
-                   Quoted(header->FileName), "!\nBetter include ",
+                   Quoted(headerHandle->FileName), "!\nBetter include ",
                    Quoted("moc_" + incKey.Base + ".cpp"),
                    " for compatibility with regular mode.\n",
                    "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
       }
       // Create mapping
-      if (!MocRegisterIncluded(incKey.Key, source, std::move(header), true)) {
+      if (!RegisterIncluded(incKey.Key, source, std::move(headerHandle),
+                            true)) {
         return false;
       }
     }
@@ -783,25 +780,24 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
       bool const ownMoc = (incKey.Base == sourceBase);
       if (!ownMoc) {
         // Don't allow <BASE>.moc include other than own in regular mode
-        LogFileError(
-          GenT::MOC, sourceFile.FileName,
-          cmStrCat("The file includes the moc file ", Quoted(incKey.Key),
-                   ",\nwhich seems to be the moc file from a different "
-                   "source file.\nThis is not supported.  Include ",
-                   Quoted(sourceBase + ".moc"),
-                   " to run moc on this source file."));
+        LogError(GenT::MOC,
+                 cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
+                          Quoted(incKey.Key),
+                          ",\nwhich seems to be the moc file from a different "
+                          "source file.\nThis is not supported.  Include ",
+                          Quoted(sourceBase + ".moc"),
+                          " to run moc on this source file."));
         return false;
       }
       // Accept but issue a warning if moc isn't required
       if (parseData.Macro.empty()) {
-        Log().WarningFile(GenT::MOC, sourceFile.FileName,
-                          cmStrCat("The file includes the moc file ",
-                                   Quoted(incKey.Key),
-                                   ", but does not contain a ",
-                                   MocConst().MacrosString(), " macro."));
+        Log().Warning(GenT::MOC,
+                      cmStrCat(sourceFile.FileName, "\nincludes the moc file ",
+                               Quoted(incKey.Key), ", but does not contain a ",
+                               MocConst().MacrosString(), " macro."));
       }
       // Create mapping
-      if (!MocRegisterIncluded(incKey.Key, source, source, false)) {
+      if (!RegisterIncluded(incKey.Key, source, source, false)) {
         return false;
       }
     }
@@ -810,79 +806,71 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
   return true;
 }
 
-cmQtAutoMocUic::SourceFileHandleT
-cmQtAutoMocUic::JobEvalCacheT::MocFindIncludedHeader(
-  std::string const& includerDir, std::string const& includeBase) const
+bool cmQtAutoMocUic::JobEvalCacheMocT::FindIncludedHeader(
+  SourceFileHandleT& headerHandle, cm::string_view includerDir,
+  cm::string_view includeBase)
 {
-  // Search in vicinity of the source
-  {
-    SourceFileHandleT res = MocFindHeader(includerDir + includeBase);
-    if (res) {
-      return res;
-    }
-  }
-  // Search in include directories
-  for (std::string const& path : MocConst().IncludePaths) {
-    std::string testPath = cmStrCat(path, '/', includeBase);
-    SourceFileHandleT res = MocFindHeader(testPath);
-    if (res) {
-      return res;
-    }
-  }
-  // Return without success
-  return SourceFileHandleT();
-}
+  // Clear search locations
+  SearchLocations.clear();
+
+  auto findHeader = [this,
+                     &headerHandle](std::string const& basePath) -> bool {
+    bool found = false;
+    std::string const baseCollapsed =
+      this->Gen()->CollapseFullPathTS(cmStrCat(basePath, '.'));
+    for (std::string const& ext : this->BaseConst().HeaderExtensions) {
+      std::string const testPath = cmStrCat(baseCollapsed, ext);
+      cmFileTime fileTime;
+      if (!fileTime.Load(testPath)) {
+        // File not found
+        continue;
+      }
 
-cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvalCacheT::MocFindHeader(
-  std::string const& basePath) const
-{
-  std::string testPath;
-  testPath.reserve(basePath.size() + 8);
-  for (std::string const& ext : BaseConst().HeaderExtensions) {
-    testPath.clear();
-    testPath += basePath;
-    testPath += '.';
-    testPath += ext;
-    cmFileTime fileTime;
-    if (fileTime.Load(testPath)) {
-      // Compute real path of the file
-      testPath = cmSystemTools::CollapseFullPath(testPath,
-                                                 BaseConst().CurrentSourceDir);
       // Return a known file if it exists already
       {
         auto it = BaseEval().Headers.find(testPath);
         if (it != BaseEval().Headers.end()) {
-          return it->second;
+          headerHandle = it->second;
+          found = true;
+          break;
         }
       }
+
       // Created and return discovered file entry
-      SourceFileHandleT& res = MocEval().HeadersDiscovered[testPath];
-      if (!res) {
-        res = std::make_shared<SourceFileT>(testPath);
-        res->FileTime = fileTime;
-        res->Moc = true;
+      {
+        SourceFileHandleT& handle = MocEval().HeadersDiscovered[testPath];
+        if (!handle) {
+          handle = std::make_shared<SourceFileT>(testPath);
+          handle->FileTime = fileTime;
+          handle->Moc = true;
+        }
+        headerHandle = handle;
+        found = true;
+        break;
       }
-      return res;
     }
-  }
-  // Return without success
-  return SourceFileHandleT();
-}
+    if (!found) {
+      this->SearchLocations.emplace_back(
+        cmQtAutoGen::ParentDir(baseCollapsed));
+    }
+    return found;
+  };
 
-std::string cmQtAutoMocUic::JobEvalCacheT::MocMessageTestHeaders(
-  cm::string_view fileBase) const
-{
-  std::string const exts =
-    cmStrCat(".{", cmJoin(BaseConst().HeaderExtensions, ","), '}');
-  // Compose result string
-  std::string res = cmStrCat("  ", fileBase, exts, '\n');
+  // Search in vicinity of the source
+  if (findHeader(cmStrCat(includerDir, includeBase))) {
+    return true;
+  }
+  // Search in include directories
   for (std::string const& path : MocConst().IncludePaths) {
-    res += cmStrCat("  ", path, '/', fileBase, exts, '\n');
+    if (findHeader(cmStrCat(path, '/', includeBase))) {
+      return true;
+    }
   }
-  return res;
+  // Return without success
+  return false;
 }
 
-bool cmQtAutoMocUic::JobEvalCacheT::MocRegisterIncluded(
+bool cmQtAutoMocUic::JobEvalCacheMocT::RegisterIncluded(
   std::string const& includeString, SourceFileHandleT includerFileHandle,
   SourceFileHandleT sourceFileHandle, bool sourceIsHeader) const
 {
@@ -925,11 +913,11 @@ bool cmQtAutoMocUic::JobEvalCacheT::MocRegisterIncluded(
   handle->OutputFile = Gen()->AbsoluteIncludePath(includeString);
 
   // Register mapping in sources/headers map
-  MocRegisterMapping(handle, sourceIsHeader);
+  RegisterMapping(handle, sourceIsHeader);
   return true;
 }
 
-void cmQtAutoMocUic::JobEvalCacheT::MocRegisterMapping(
+void cmQtAutoMocUic::JobEvalCacheMocT::RegisterMapping(
   MappingHandleT mappingHandle, bool sourceIsHeader) const
 {
   auto& regMap =
@@ -947,17 +935,33 @@ void cmQtAutoMocUic::JobEvalCacheT::MocRegisterMapping(
   }
 }
 
-bool cmQtAutoMocUic::JobEvalCacheT::UicEval(SourceFileMapT const& fileMap)
+std::string cmQtAutoMocUic::JobEvalCacheMocT::MessageHeader(
+  cm::string_view headerBase) const
 {
-  for (auto const& pair : fileMap) {
-    if (!UicEvalFile(pair.second)) {
-      return false;
+  return Quoted(cmStrCat(
+    headerBase, ".{", cmJoin(this->BaseConst().HeaderExtensions, ","), '}'));
+}
+
+void cmQtAutoMocUic::JobEvalCacheUicT::Process()
+{
+  // Prepare buffers
+  SearchLocations.reserve((UicConst().SearchPaths.size() + 1) * 2);
+
+  // Evaluate headers
+  for (auto const& pair : BaseEval().Headers) {
+    if (!EvalFile(pair.second)) {
+      return;
+    }
+  }
+  // Evaluate sources
+  for (auto const& pair : BaseEval().Sources) {
+    if (!EvalFile(pair.second)) {
+      return;
     }
   }
-  return true;
 }
 
-bool cmQtAutoMocUic::JobEvalCacheT::UicEvalFile(
+bool cmQtAutoMocUic::JobEvalCacheUicT::EvalFile(
   SourceFileHandleT const& sourceFileHandle)
 {
   SourceFileT const& sourceFile = *sourceFileHandle;
@@ -966,17 +970,25 @@ bool cmQtAutoMocUic::JobEvalCacheT::UicEvalFile(
     return true;
   }
 
-  std::string const sourceDir = SubDirPrefix(sourceFile.FileName);
+  std::string const sourceDirPrefix = SubDirPrefix(sourceFile.FileName);
   for (IncludeKeyT const& incKey : Include) {
-    // Find .ui file name
-    SourceFileHandleT uiFileHandle =
-      UicFindIncludedUi(sourceFile.FileName, sourceDir, incKey);
-    if (!uiFileHandle || UicConst().skipped(uiFileHandle->FileName)) {
+    // Find .ui file
+    UiName = cmStrCat(incKey.Base, ".ui");
+    if (!FindIncludedUi(sourceDirPrefix, incKey.Dir)) {
+      LogError(GenT::UIC,
+               cmStrCat(sourceFile.FileName, "\nincludes the uic file ",
+                        Quoted(incKey.Key), ",\nbut the user interface file ",
+                        Quoted(UiName),
+                        "\ncould not be found in the following directories\n",
+                        MessageSearchLocations()));
+      return false;
+    }
+    // Check if the file is skipped
+    if (UicConst().skipped(UiFileHandle->FileName)) {
       continue;
     }
     // Register mapping
-    if (!UicRegisterMapping(incKey.Key, std::move(uiFileHandle),
-                            sourceFileHandle)) {
+    if (!RegisterMapping(incKey.Key, sourceFileHandle)) {
       return false;
     }
   }
@@ -984,15 +996,68 @@ bool cmQtAutoMocUic::JobEvalCacheT::UicEvalFile(
   return true;
 }
 
-bool cmQtAutoMocUic::JobEvalCacheT::UicRegisterMapping(
-  std::string const& includeString, SourceFileHandleT uiFileHandle,
-  SourceFileHandleT includerFileHandle)
+bool cmQtAutoMocUic::JobEvalCacheUicT::FindIncludedUi(
+  cm::string_view sourceDirPrefix, cm::string_view includePrefix)
+{
+  // Clear locations buffer
+  SearchLocations.clear();
+
+  auto findUi = [this](std::string const& testPath) -> bool {
+    std::string const fullPath = this->Gen()->CollapseFullPathTS(testPath);
+    cmFileTime fileTime;
+    if (!fileTime.Load(fullPath)) {
+      this->SearchLocations.emplace_back(cmQtAutoGen::ParentDir(fullPath));
+      return false;
+    }
+    // .ui file found in files system!
+    // Get or create .ui file handle
+    SourceFileHandleT& handle = this->UicEval().UiFiles[fullPath];
+    if (!handle) {
+      // The file wasn't registered, yet
+      handle = std::make_shared<SourceFileT>(fullPath);
+      handle->FileTime = fileTime;
+    }
+    this->UiFileHandle = handle;
+    return true;
+  };
+
+  // Vicinity of the source
+  if (findUi(cmStrCat(sourceDirPrefix, UiName))) {
+    return true;
+  }
+  if (!includePrefix.empty()) {
+    if (findUi(cmStrCat(sourceDirPrefix, includePrefix, UiName))) {
+      return true;
+    }
+  }
+  // Additional AUTOUIC search paths
+  auto const& searchPaths = UicConst().SearchPaths;
+  if (!searchPaths.empty()) {
+    for (std::string const& sPath : searchPaths) {
+      if (findUi(cmStrCat(sPath, '/', UiName))) {
+        return true;
+      }
+    }
+    if (!includePrefix.empty()) {
+      for (std::string const& sPath : searchPaths) {
+        if (findUi(cmStrCat(sPath, '/', includePrefix, UiName))) {
+          return true;
+        }
+      }
+    }
+  }
+
+  return false;
+}
+
+bool cmQtAutoMocUic::JobEvalCacheUicT::RegisterMapping(
+  std::string const& includeString, SourceFileHandleT includerFileHandle)
 {
   auto& Includes = Gen()->UicEval().Includes;
   auto it = Includes.find(includeString);
   if (it != Includes.end()) {
     MappingHandleT const& handle = it->second;
-    if (handle->SourceFile != uiFileHandle) {
+    if (handle->SourceFile != UiFileHandle) {
       // The output file already gets generated - from a different .ui file!
       std::string files =
         cmStrCat("  ", Quoted(includerFileHandle->FileName), '\n');
@@ -1006,7 +1071,7 @@ bool cmQtAutoMocUic::JobEvalCacheT::UicRegisterMapping(
           Quoted(includeString),
           ", but\nthe uic file would be generated from different "
           "user interface files\n  ",
-          Quoted(uiFileHandle->FileName), " and\n  ",
+          Quoted(UiFileHandle->FileName), " and\n  ",
           Quoted(handle->SourceFile->FileName),
           ".\nConsider to\n"
           "  - add a directory prefix to a \"ui_<NAME>.h\" include "
@@ -1022,7 +1087,7 @@ bool cmQtAutoMocUic::JobEvalCacheT::UicRegisterMapping(
     MappingHandleT handle = std::make_shared<MappingT>();
     handle->IncludeString = includeString;
     handle->IncluderFiles.emplace_back(std::move(includerFileHandle));
-    handle->SourceFile = std::move(uiFileHandle);
+    handle->SourceFile = UiFileHandle;
     handle->OutputFile = Gen()->AbsoluteIncludePath(includeString);
     // Register mapping
     Includes.emplace(includeString, std::move(handle));
@@ -1030,69 +1095,24 @@ bool cmQtAutoMocUic::JobEvalCacheT::UicRegisterMapping(
   return true;
 }
 
-cmQtAutoMocUic::SourceFileHandleT
-cmQtAutoMocUic::JobEvalCacheT::UicFindIncludedUi(
-  std::string const& sourceFile, std::string const& sourceDir,
-  IncludeKeyT const& incKey) const
+void cmQtAutoMocUic::JobEvalCacheFinishT::Process()
 {
-  std::string searchFileName = cmStrCat(incKey.Base, ".ui");
-  // Collect search paths list
-  std::vector<std::string> testFiles;
-  {
-    auto& searchPaths = UicConst().SearchPaths;
-    testFiles.reserve((searchPaths.size() + 1) * 2);
-
-    // Vicinity of the source
-    testFiles.emplace_back(sourceDir + searchFileName);
-    if (!incKey.Dir.empty()) {
-      testFiles.emplace_back(cmStrCat(sourceDir, incKey.Dir, searchFileName));
-    }
-    // AUTOUIC search paths
-    if (!searchPaths.empty()) {
-      for (std::string const& sPath : searchPaths) {
-        testFiles.emplace_back(cmStrCat(sPath, '/', searchFileName));
-      }
-      if (!incKey.Dir.empty()) {
-        for (std::string const& sPath : searchPaths) {
-          testFiles.emplace_back(
-            cmStrCat(sPath, '/', incKey.Dir, searchFileName));
-        }
-      }
-    }
-  }
-
-  // Search for the .ui file!
-  for (std::string const& testFile : testFiles) {
-    cmFileTime fileTime;
-    if (fileTime.Load(testFile)) {
-      // .ui file found in files system!
-      std::string fullPath = cmSystemTools::CollapseFullPath(
-        testFile, BaseConst().CurrentSourceDir);
-      // Get or create .ui file handle
-      SourceFileHandleT& handle = Gen()->UicEval().UiFiles[fullPath];
-      if (!handle) {
-        // The file wasn't registered, yet
-        handle = std::make_shared<SourceFileT>(fullPath);
-        handle->FileTime = fileTime;
-      }
-      return handle;
-    }
-  }
+  // Add discovered header parse jobs
+  Gen()->CreateParseJobs<JobParseHeaderT>(MocEval().HeadersDiscovered);
 
-  // Log error
+  // Add dependency probing jobs
   {
-    std::string files;
-    for (std::string const& testFile : testFiles) {
-      files += cmStrCat("  ", Quoted(testFile), '\n');
+    // Add fence job to ensure all parsing has finished
+    Gen()->WorkerPool().EmplaceJob<JobFenceT>();
+    if (MocConst().Enabled) {
+      Gen()->WorkerPool().EmplaceJob<JobProbeDepsMocT>();
+    }
+    if (UicConst().Enabled) {
+      Gen()->WorkerPool().EmplaceJob<JobProbeDepsUicT>();
     }
-    LogFileError(
-      GenT::UIC, sourceFile,
-      cmStrCat("The file includes the uic file ", Quoted(incKey.Key),
-               ",\nbut the user interface file ", Quoted(searchFileName),
-               "\ncould not be found in the following locations\n", files));
+    // Add probe finish job
+    Gen()->WorkerPool().EmplaceJob<JobProbeDepsFinishT>();
   }
-
-  return SourceFileHandleT();
 }
 
 void cmQtAutoMocUic::JobProbeDepsMocT::Process()
@@ -1863,18 +1883,38 @@ void cmQtAutoMocUic::CreateParseJobs(SourceFileMapT const& sourceMap)
   }
 }
 
+/** Concurrently callable implementation of cmSystemTools::CollapseFullPath */
+std::string cmQtAutoMocUic::CollapseFullPathTS(std::string const& path) const
+{
+  std::lock_guard<std::mutex> guard(CMakeLibMutex_);
+  return cmSystemTools::CollapseFullPath(path, BaseConst().CurrentSourceDir);
+}
+
 void cmQtAutoMocUic::InitJobs()
 {
   // Add moc_predefs.h job
   if (MocConst().Enabled && !MocConst().PredefsCmd.empty()) {
     WorkerPool().EmplaceJob<JobMocPredefsT>();
   }
+
   // Add header parse jobs
   CreateParseJobs<JobParseHeaderT>(BaseEval().Headers);
   // Add source parse jobs
   CreateParseJobs<JobParseSourceT>(BaseEval().Sources);
-  // Add evaluate job
-  WorkerPool().EmplaceJob<JobEvalCacheT>();
+
+  // Add parse cache evaluations jobs
+  {
+    // Add a fence job to ensure all parsing has finished
+    WorkerPool().EmplaceJob<JobFenceT>();
+    if (MocConst().Enabled) {
+      WorkerPool().EmplaceJob<JobEvalCacheMocT>();
+    }
+    if (UicConst().Enabled) {
+      WorkerPool().EmplaceJob<JobEvalCacheUicT>();
+    }
+    // Add evaluate job
+    WorkerPool().EmplaceJob<JobEvalCacheFinishT>();
+  }
 }
 
 bool cmQtAutoMocUic::Process()
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 3af1846..e480751 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -16,6 +16,7 @@
 #include <cstddef>
 #include <map>
 #include <memory>
+#include <mutex>
 #include <set>
 #include <string>
 #include <unordered_map>
@@ -384,34 +385,50 @@ public:
     void Process() override;
   };
 
-  /** Evaluate cached file parse data.  */
-  class JobEvalCacheT : public JobFenceT
+  /** Evaluate cached file parse data - moc.  */
+  class JobEvalCacheT : public JobT
+  {
+  protected:
+    std::string MessageSearchLocations() const;
+    std::vector<std::string> SearchLocations;
+  };
+
+  /** Evaluate cached file parse data - moc.  */
+  class JobEvalCacheMocT : public JobEvalCacheT
   {
     void Process() override;
+    bool EvalHeader(SourceFileHandleT source);
+    bool EvalSource(SourceFileHandleT const& source);
+    bool FindIncludedHeader(SourceFileHandleT& headerHandle,
+                            cm::string_view includerDir,
+                            cm::string_view includeBase);
+    bool RegisterIncluded(std::string const& includeString,
+                          SourceFileHandleT includerFileHandle,
+                          SourceFileHandleT sourceFileHandle,
+                          bool sourceIsHeader) const;
+    void RegisterMapping(MappingHandleT mappingHandle,
+                         bool sourceIsHeader) const;
+    std::string MessageHeader(cm::string_view headerBase) const;
+  };
 
-    // -- Moc
-    bool MocEvalHeader(SourceFileHandleT source);
-    bool MocEvalSource(SourceFileHandleT const& source);
-    SourceFileHandleT MocFindIncludedHeader(
-      std::string const& includerDir, std::string const& includeBase) const;
-    SourceFileHandleT MocFindHeader(std::string const& basePath) const;
-    std::string MocMessageTestHeaders(cm::string_view fileBase) const;
-    bool MocRegisterIncluded(std::string const& includeString,
-                             SourceFileHandleT includerFileHandle,
-                             SourceFileHandleT sourceFileHandle,
-                             bool sourceIsHeader) const;
-    void MocRegisterMapping(MappingHandleT mappingHandle,
-                            bool sourceIsHeader) const;
-
-    // -- Uic
-    bool UicEval(SourceFileMapT const& fileMap);
-    bool UicEvalFile(SourceFileHandleT const& sourceFileHandle);
-    SourceFileHandleT UicFindIncludedUi(std::string const& sourceFile,
-                                        std::string const& sourceDir,
-                                        IncludeKeyT const& incKey) const;
-    bool UicRegisterMapping(std::string const& includeString,
-                            SourceFileHandleT uiFileHandle,
-                            SourceFileHandleT includerFileHandle);
+  /** Evaluate cached file parse data - uic.  */
+  class JobEvalCacheUicT : public JobEvalCacheT
+  {
+    void Process() override;
+    bool EvalFile(SourceFileHandleT const& sourceFileHandle);
+    bool FindIncludedUi(cm::string_view sourceDirPrefix,
+                        cm::string_view includePrefix);
+    bool RegisterMapping(std::string const& includeString,
+                         SourceFileHandleT includerFileHandle);
+
+    std::string UiName;
+    SourceFileHandleT UiFileHandle;
+  };
+
+  /** Evaluate cached file parse data - finish  */
+  class JobEvalCacheFinishT : public JobFenceT
+  {
+    void Process() override;
   };
 
   /** Dependency probing base job.  */
@@ -505,6 +522,7 @@ public:
   std::string AbsoluteIncludePath(cm::string_view relativePath) const;
   template <class JOBTYPE>
   void CreateParseJobs(SourceFileMapT const& sourceMap);
+  std::string CollapseFullPathTS(std::string const& path) const;
 
 private:
   // -- Utility accessors
@@ -541,6 +559,8 @@ private:
   // -- Worker thread pool
   std::atomic<bool> JobError_ = ATOMIC_VAR_INIT(false);
   cmWorkerPool WorkerPool_;
+  // -- Concurrent processing
+  mutable std::mutex CMakeLibMutex_;
 };
 
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a3f185c1a1f5f67e6c7d8d821f17619208e6311
commit 1a3f185c1a1f5f67e6c7d8d821f17619208e6311
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 12:14:12 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Split JobProbeDepsT job into separate moc and uic jobs
    
    By splitting `JobProbeDepsT` into two independent `JobProbeDepsMocT`,
    `JobProbeDepsUicT`, the moc and uic job generation will happen concurrently.
    This should improve the execution speed, when both AUTOMOC and AUTOUIC are
    enabled.
    
    Parent directory names for moc and uic output files are are collected in
    a `std::unordered_set<std::string>` and get created in a batch.
    Beforehand we tried to create the parent directory for each output file.
    This led to duplications of `MakeDirectory` calls when there were multiple
    output files in the same directory (which is the case usually).

diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index f3c78d3..57c8825 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -162,6 +162,15 @@ std::string cmQtAutoGen::QuotedCommand(std::vector<std::string> const& command)
   return res;
 }
 
+std::string cmQtAutoGen::ParentDir(cm::string_view filename)
+{
+  auto slashPos = filename.rfind('/');
+  if (slashPos == cm::string_view::npos) {
+    return std::string();
+  }
+  return std::string(filename.substr(0, slashPos));
+}
+
 std::string cmQtAutoGen::SubDirPrefix(cm::string_view filename)
 {
   auto slashPos = filename.rfind('/');
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index fb15586..71969ee 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -80,6 +80,9 @@ public:
 
   static std::string QuotedCommand(std::vector<std::string> const& command);
 
+  /// @brief Returns the parent directory of the file (thread safe)
+  static std::string ParentDir(cm::string_view filename);
+
   /// @brief Returns the parent directory of the file with a "/" suffix
   static std::string SubDirPrefix(cm::string_view filename);
 
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index fe63dec..6265777 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -577,8 +577,20 @@ void cmQtAutoMocUic::JobEvalCacheT::Process()
 
   // Add discovered header parse jobs
   Gen()->CreateParseJobs<JobParseHeaderT>(MocEval().HeadersDiscovered);
-  // Add generate job after
-  Gen()->WorkerPool().EmplaceJob<JobProbeDepsT>();
+
+  // Add dependency probing jobs
+  {
+    // Add fence job to ensure all parsing has finished
+    Gen()->WorkerPool().EmplaceJob<JobFenceT>();
+    if (MocConst().Enabled) {
+      Gen()->WorkerPool().EmplaceJob<JobProbeDepsMocT>();
+    }
+    if (UicConst().Enabled) {
+      Gen()->WorkerPool().EmplaceJob<JobProbeDepsUicT>();
+    }
+    // Add probe finish job
+    Gen()->WorkerPool().EmplaceJob<JobProbeDepsFinishT>();
+  }
 }
 
 bool cmQtAutoMocUic::JobEvalCacheT::MocEvalHeader(SourceFileHandleT source)
@@ -1083,57 +1095,38 @@ cmQtAutoMocUic::JobEvalCacheT::UicFindIncludedUi(
   return SourceFileHandleT();
 }
 
-void cmQtAutoMocUic::JobProbeDepsT::Process()
+void cmQtAutoMocUic::JobProbeDepsMocT::Process()
 {
-  // Add moc compile jobs
-  if (MocConst().Enabled) {
-    for (auto const& pair : MocEval().HeaderMappings) {
-      // Register if this mapping is a candidate for mocs_compilation.cpp
-      bool const compFile = pair.second->IncludeString.empty();
-      if (compFile) {
-        MocEval().CompFiles.emplace_back(pair.second->SourceFile->BuildPath);
-      }
-      if (!MocGenerate(pair.second, compFile)) {
-        return;
-      }
+  // Create moc header jobs
+  for (auto const& pair : MocEval().HeaderMappings) {
+    // Register if this mapping is a candidate for mocs_compilation.cpp
+    bool const compFile = pair.second->IncludeString.empty();
+    if (compFile) {
+      MocEval().CompFiles.emplace_back(pair.second->SourceFile->BuildPath);
     }
-    for (auto const& pair : MocEval().SourceMappings) {
-      if (!MocGenerate(pair.second, false)) {
-        return;
-      }
+    if (!Generate(pair.second, compFile)) {
+      return;
     }
-
-    // Add mocs compilations job on demand
-    Gen()->WorkerPool().EmplaceJob<JobMocsCompilationT>();
   }
 
-  // Add uic compile jobs
-  if (UicConst().Enabled) {
-    for (auto const& pair : Gen()->UicEval().Includes) {
-      if (!UicGenerate(pair.second)) {
-        return;
-      }
+  // Create moc source jobs
+  for (auto const& pair : MocEval().SourceMappings) {
+    if (!Generate(pair.second, false)) {
+      return;
     }
   }
-
-  // Add finish job
-  Gen()->WorkerPool().EmplaceJob<JobFinishT>();
 }
 
-bool cmQtAutoMocUic::JobProbeDepsT::MocGenerate(MappingHandleT const& mapping,
+bool cmQtAutoMocUic::JobProbeDepsMocT::Generate(MappingHandleT const& mapping,
                                                 bool compFile) const
 {
   std::unique_ptr<std::string> reason;
   if (Log().Verbose()) {
     reason = cm::make_unique<std::string>();
   }
-  if (MocUpdate(*mapping, reason.get())) {
-    // Create the parent directory
-    if (!MakeParentDirectory(mapping->OutputFile)) {
-      LogFileError(GenT::MOC, mapping->OutputFile,
-                   "Could not create parent directory.");
-      return false;
-    }
+  if (Probe(*mapping, reason.get())) {
+    // Register the parent directory for creation
+    MocEval().OutputDirs.emplace(cmQtAutoGen::ParentDir(mapping->OutputFile));
     // Add moc job
     Gen()->WorkerPool().EmplaceJob<JobCompileMocT>(mapping, std::move(reason));
     // Check if a moc job for a mocs_compilation.cpp entry was generated
@@ -1144,8 +1137,8 @@ bool cmQtAutoMocUic::JobProbeDepsT::MocGenerate(MappingHandleT const& mapping,
   return true;
 }
 
-bool cmQtAutoMocUic::JobProbeDepsT::MocUpdate(MappingT const& mapping,
-                                              std::string* reason) const
+bool cmQtAutoMocUic::JobProbeDepsMocT::Probe(MappingT const& mapping,
+                                             std::string* reason) const
 {
   std::string const& sourceFile = mapping.SourceFile->FileName;
   std::string const& outputFile = mapping.OutputFile;
@@ -1209,7 +1202,7 @@ bool cmQtAutoMocUic::JobProbeDepsT::MocUpdate(MappingT const& mapping,
     std::string const sourceDir = SubDirPrefix(sourceFile);
     for (std::string const& dep : mapping.SourceFile->ParseData->Moc.Depends) {
       // Find dependency file
-      auto const depMatch = MocFindDependency(sourceDir, dep);
+      auto const depMatch = FindDependency(sourceDir, dep);
       if (depMatch.first.empty()) {
         Log().WarningFile(GenT::MOC, sourceFile,
                           "Could not find dependency file " + Quoted(dep));
@@ -1232,7 +1225,7 @@ bool cmQtAutoMocUic::JobProbeDepsT::MocUpdate(MappingT const& mapping,
 }
 
 std::pair<std::string, cmFileTime>
-cmQtAutoMocUic::JobProbeDepsT::MocFindDependency(
+cmQtAutoMocUic::JobProbeDepsMocT::FindDependency(
   std::string const& sourceDir, std::string const& includeString) const
 {
   using ResPair = std::pair<std::string, cmFileTime>;
@@ -1254,28 +1247,27 @@ cmQtAutoMocUic::JobProbeDepsT::MocFindDependency(
   return ResPair();
 }
 
-bool cmQtAutoMocUic::JobProbeDepsT::UicGenerate(
-  MappingHandleT const& mapping) const
+void cmQtAutoMocUic::JobProbeDepsUicT::Process()
 {
-  std::unique_ptr<std::string> reason;
-  if (Log().Verbose()) {
-    reason = cm::make_unique<std::string>();
-  }
-  if (UicUpdate(*mapping, reason.get())) {
-    // Create the parent directory
-    if (!MakeParentDirectory(mapping->OutputFile)) {
-      LogFileError(GenT::UIC, mapping->OutputFile,
-                   "Could not create parent directory.");
-      return false;
+  for (auto const& pair : Gen()->UicEval().Includes) {
+    MappingHandleT const& mapping = pair.second;
+    std::unique_ptr<std::string> reason;
+    if (Log().Verbose()) {
+      reason = cm::make_unique<std::string>();
+    }
+    if (!Probe(*mapping, reason.get())) {
+      continue;
     }
+
+    // Register the parent directory for creation
+    UicEval().OutputDirs.emplace(cmQtAutoGen::ParentDir(mapping->OutputFile));
     // Add uic job
     Gen()->WorkerPool().EmplaceJob<JobCompileUicT>(mapping, std::move(reason));
   }
-  return true;
 }
 
-bool cmQtAutoMocUic::JobProbeDepsT::UicUpdate(MappingT const& mapping,
-                                              std::string* reason) const
+bool cmQtAutoMocUic::JobProbeDepsUicT::Probe(MappingT const& mapping,
+                                             std::string* reason) const
 {
   std::string const& sourceFile = mapping.SourceFile->FileName;
   std::string const& outputFile = mapping.OutputFile;
@@ -1324,6 +1316,40 @@ bool cmQtAutoMocUic::JobProbeDepsT::UicUpdate(MappingT const& mapping,
   return false;
 }
 
+void cmQtAutoMocUic::JobProbeDepsFinishT::Process()
+{
+  // Create output directories
+  {
+    using StringSet = std::unordered_set<std::string>;
+    auto createDirs = [this](GenT genType, StringSet const& dirSet) {
+      for (std::string const& dirName : dirSet) {
+        if (!cmSystemTools::MakeDirectory(dirName)) {
+          this->LogFileError(genType, dirName, "Could not create directory.");
+          return;
+        }
+      }
+    };
+    if (MocConst().Enabled && UicConst().Enabled) {
+      StringSet outputDirs = MocEval().OutputDirs;
+      outputDirs.insert(UicEval().OutputDirs.begin(),
+                        UicEval().OutputDirs.end());
+      createDirs(GenT::GEN, outputDirs);
+    } else if (MocConst().Enabled) {
+      createDirs(GenT::MOC, MocEval().OutputDirs);
+    } else if (UicConst().Enabled) {
+      createDirs(GenT::UIC, UicEval().OutputDirs);
+    }
+  }
+
+  if (MocConst().Enabled) {
+    // Add mocs compilations job
+    Gen()->WorkerPool().EmplaceJob<JobMocsCompilationT>();
+  }
+
+  // Add finish job
+  Gen()->WorkerPool().EmplaceJob<JobFinishT>();
+}
+
 void cmQtAutoMocUic::JobCompileMocT::Process()
 {
   std::string const& sourceFile = Mapping->SourceFile->FileName;
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 3e815cd..3af1846 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -243,6 +243,8 @@ public:
     MappingMapT Includes;
     // -- Discovered files
     SourceFileMapT HeadersDiscovered;
+    // -- Output directories
+    std::unordered_set<std::string> OutputDirs;
     // -- Mocs compilation
     bool CompUpdated = false;
     std::vector<std::string> CompFiles;
@@ -277,8 +279,12 @@ public:
   class UicEvalT
   {
   public:
+    // -- Discovered files
     SourceFileMapT UiFiles;
+    // -- Mappings
     MappingMapT Includes;
+    // -- Output directories
+    std::unordered_set<std::string> OutputDirs;
   };
 
   /** Abstract job class for concurrent job processing.  */
@@ -408,18 +414,32 @@ public:
                             SourceFileHandleT includerFileHandle);
   };
 
-  /** Probes file dependencies and generates moc and uic compile jobs.  */
-  class JobProbeDepsT : public JobFenceT
+  /** Dependency probing base job.  */
+  class JobProbeDepsT : public JobT
+  {
+  };
+
+  /** Probes file dependencies and generates moc compile jobs.  */
+  class JobProbeDepsMocT : public JobProbeDepsT
   {
     void Process() override;
-    // -- Moc
-    bool MocGenerate(MappingHandleT const& mapping, bool compFile) const;
-    bool MocUpdate(MappingT const& mapping, std::string* reason) const;
-    std::pair<std::string, cmFileTime> MocFindDependency(
+    bool Generate(MappingHandleT const& mapping, bool compFile) const;
+    bool Probe(MappingT const& mapping, std::string* reason) const;
+    std::pair<std::string, cmFileTime> FindDependency(
       std::string const& sourceDir, std::string const& includeString) const;
-    // -- Uic
-    bool UicGenerate(MappingHandleT const& mapping) const;
-    bool UicUpdate(MappingT const& mapping, std::string* reason) const;
+  };
+
+  /** Probes file dependencies and generates uic compile jobs.  */
+  class JobProbeDepsUicT : public JobProbeDepsT
+  {
+    void Process() override;
+    bool Probe(MappingT const& mapping, std::string* reason) const;
+  };
+
+  /** Dependency probing finish job.  */
+  class JobProbeDepsFinishT : public JobFenceT
+  {
+    void Process() override;
   };
 
   /** Meta compiler base job.  */

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=726ea1d15134591c352468b64b3e92f04f2449bb
commit 726ea1d15134591c352468b64b3e92f04f2449bb
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 11:06:00 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Rename job classes

diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index c305ca6..fe63dec 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -551,7 +551,7 @@ void cmQtAutoMocUic::JobParseSourceT::Process()
   }
 }
 
-void cmQtAutoMocUic::JobEvaluateT::Process()
+void cmQtAutoMocUic::JobEvalCacheT::Process()
 {
   // Evaluate for moc
   if (MocConst().Enabled) {
@@ -578,10 +578,10 @@ void cmQtAutoMocUic::JobEvaluateT::Process()
   // Add discovered header parse jobs
   Gen()->CreateParseJobs<JobParseHeaderT>(MocEval().HeadersDiscovered);
   // Add generate job after
-  Gen()->WorkerPool().EmplaceJob<JobGenerateT>();
+  Gen()->WorkerPool().EmplaceJob<JobProbeDepsT>();
 }
 
-bool cmQtAutoMocUic::JobEvaluateT::MocEvalHeader(SourceFileHandleT source)
+bool cmQtAutoMocUic::JobEvalCacheT::MocEvalHeader(SourceFileHandleT source)
 {
   SourceFileT const& sourceFile = *source;
   auto const& parseData = sourceFile.ParseData->Moc;
@@ -608,7 +608,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalHeader(SourceFileHandleT source)
   return true;
 }
 
-bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource(
+bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource(
   SourceFileHandleT const& source)
 {
   SourceFileT const& sourceFile = *source;
@@ -799,7 +799,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource(
 }
 
 cmQtAutoMocUic::SourceFileHandleT
-cmQtAutoMocUic::JobEvaluateT::MocFindIncludedHeader(
+cmQtAutoMocUic::JobEvalCacheT::MocFindIncludedHeader(
   std::string const& includerDir, std::string const& includeBase) const
 {
   // Search in vicinity of the source
@@ -821,7 +821,7 @@ cmQtAutoMocUic::JobEvaluateT::MocFindIncludedHeader(
   return SourceFileHandleT();
 }
 
-cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvaluateT::MocFindHeader(
+cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvalCacheT::MocFindHeader(
   std::string const& basePath) const
 {
   std::string testPath;
@@ -857,7 +857,7 @@ cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvaluateT::MocFindHeader(
   return SourceFileHandleT();
 }
 
-std::string cmQtAutoMocUic::JobEvaluateT::MocMessageTestHeaders(
+std::string cmQtAutoMocUic::JobEvalCacheT::MocMessageTestHeaders(
   cm::string_view fileBase) const
 {
   std::string const exts =
@@ -870,7 +870,7 @@ std::string cmQtAutoMocUic::JobEvaluateT::MocMessageTestHeaders(
   return res;
 }
 
-bool cmQtAutoMocUic::JobEvaluateT::MocRegisterIncluded(
+bool cmQtAutoMocUic::JobEvalCacheT::MocRegisterIncluded(
   std::string const& includeString, SourceFileHandleT includerFileHandle,
   SourceFileHandleT sourceFileHandle, bool sourceIsHeader) const
 {
@@ -917,7 +917,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocRegisterIncluded(
   return true;
 }
 
-void cmQtAutoMocUic::JobEvaluateT::MocRegisterMapping(
+void cmQtAutoMocUic::JobEvalCacheT::MocRegisterMapping(
   MappingHandleT mappingHandle, bool sourceIsHeader) const
 {
   auto& regMap =
@@ -935,7 +935,7 @@ void cmQtAutoMocUic::JobEvaluateT::MocRegisterMapping(
   }
 }
 
-bool cmQtAutoMocUic::JobEvaluateT::UicEval(SourceFileMapT const& fileMap)
+bool cmQtAutoMocUic::JobEvalCacheT::UicEval(SourceFileMapT const& fileMap)
 {
   for (auto const& pair : fileMap) {
     if (!UicEvalFile(pair.second)) {
@@ -945,7 +945,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEval(SourceFileMapT const& fileMap)
   return true;
 }
 
-bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile(
+bool cmQtAutoMocUic::JobEvalCacheT::UicEvalFile(
   SourceFileHandleT const& sourceFileHandle)
 {
   SourceFileT const& sourceFile = *sourceFileHandle;
@@ -972,7 +972,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile(
   return true;
 }
 
-bool cmQtAutoMocUic::JobEvaluateT::UicRegisterMapping(
+bool cmQtAutoMocUic::JobEvalCacheT::UicRegisterMapping(
   std::string const& includeString, SourceFileHandleT uiFileHandle,
   SourceFileHandleT includerFileHandle)
 {
@@ -1019,7 +1019,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicRegisterMapping(
 }
 
 cmQtAutoMocUic::SourceFileHandleT
-cmQtAutoMocUic::JobEvaluateT::UicFindIncludedUi(
+cmQtAutoMocUic::JobEvalCacheT::UicFindIncludedUi(
   std::string const& sourceFile, std::string const& sourceDir,
   IncludeKeyT const& incKey) const
 {
@@ -1083,7 +1083,7 @@ cmQtAutoMocUic::JobEvaluateT::UicFindIncludedUi(
   return SourceFileHandleT();
 }
 
-void cmQtAutoMocUic::JobGenerateT::Process()
+void cmQtAutoMocUic::JobProbeDepsT::Process()
 {
   // Add moc compile jobs
   if (MocConst().Enabled) {
@@ -1120,8 +1120,8 @@ void cmQtAutoMocUic::JobGenerateT::Process()
   Gen()->WorkerPool().EmplaceJob<JobFinishT>();
 }
 
-bool cmQtAutoMocUic::JobGenerateT::MocGenerate(MappingHandleT const& mapping,
-                                               bool compFile) const
+bool cmQtAutoMocUic::JobProbeDepsT::MocGenerate(MappingHandleT const& mapping,
+                                                bool compFile) const
 {
   std::unique_ptr<std::string> reason;
   if (Log().Verbose()) {
@@ -1135,7 +1135,7 @@ bool cmQtAutoMocUic::JobGenerateT::MocGenerate(MappingHandleT const& mapping,
       return false;
     }
     // Add moc job
-    Gen()->WorkerPool().EmplaceJob<JobMocT>(mapping, std::move(reason));
+    Gen()->WorkerPool().EmplaceJob<JobCompileMocT>(mapping, std::move(reason));
     // Check if a moc job for a mocs_compilation.cpp entry was generated
     if (compFile) {
       MocEval().CompUpdated = true;
@@ -1144,8 +1144,8 @@ bool cmQtAutoMocUic::JobGenerateT::MocGenerate(MappingHandleT const& mapping,
   return true;
 }
 
-bool cmQtAutoMocUic::JobGenerateT::MocUpdate(MappingT const& mapping,
-                                             std::string* reason) const
+bool cmQtAutoMocUic::JobProbeDepsT::MocUpdate(MappingT const& mapping,
+                                              std::string* reason) const
 {
   std::string const& sourceFile = mapping.SourceFile->FileName;
   std::string const& outputFile = mapping.OutputFile;
@@ -1232,7 +1232,7 @@ bool cmQtAutoMocUic::JobGenerateT::MocUpdate(MappingT const& mapping,
 }
 
 std::pair<std::string, cmFileTime>
-cmQtAutoMocUic::JobGenerateT::MocFindDependency(
+cmQtAutoMocUic::JobProbeDepsT::MocFindDependency(
   std::string const& sourceDir, std::string const& includeString) const
 {
   using ResPair = std::pair<std::string, cmFileTime>;
@@ -1254,7 +1254,7 @@ cmQtAutoMocUic::JobGenerateT::MocFindDependency(
   return ResPair();
 }
 
-bool cmQtAutoMocUic::JobGenerateT::UicGenerate(
+bool cmQtAutoMocUic::JobProbeDepsT::UicGenerate(
   MappingHandleT const& mapping) const
 {
   std::unique_ptr<std::string> reason;
@@ -1269,13 +1269,13 @@ bool cmQtAutoMocUic::JobGenerateT::UicGenerate(
       return false;
     }
     // Add uic job
-    Gen()->WorkerPool().EmplaceJob<JobUicT>(mapping, std::move(reason));
+    Gen()->WorkerPool().EmplaceJob<JobCompileUicT>(mapping, std::move(reason));
   }
   return true;
 }
 
-bool cmQtAutoMocUic::JobGenerateT::UicUpdate(MappingT const& mapping,
-                                             std::string* reason) const
+bool cmQtAutoMocUic::JobProbeDepsT::UicUpdate(MappingT const& mapping,
+                                              std::string* reason) const
 {
   std::string const& sourceFile = mapping.SourceFile->FileName;
   std::string const& outputFile = mapping.OutputFile;
@@ -1324,7 +1324,7 @@ bool cmQtAutoMocUic::JobGenerateT::UicUpdate(MappingT const& mapping,
   return false;
 }
 
-void cmQtAutoMocUic::JobMocT::Process()
+void cmQtAutoMocUic::JobCompileMocT::Process()
 {
   std::string const& sourceFile = Mapping->SourceFile->FileName;
   std::string const& outputFile = Mapping->OutputFile;
@@ -1368,7 +1368,7 @@ void cmQtAutoMocUic::JobMocT::Process()
   }
 }
 
-void cmQtAutoMocUic::JobUicT::Process()
+void cmQtAutoMocUic::JobCompileUicT::Process()
 {
   std::string const& sourceFile = Mapping->SourceFile->FileName;
   std::string const& outputFile = Mapping->OutputFile;
@@ -1848,7 +1848,7 @@ void cmQtAutoMocUic::InitJobs()
   // Add source parse jobs
   CreateParseJobs<JobParseSourceT>(BaseEval().Sources);
   // Add evaluate job
-  WorkerPool().EmplaceJob<JobEvaluateT>();
+  WorkerPool().EmplaceJob<JobEvalCacheT>();
 }
 
 bool cmQtAutoMocUic::Process()
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 2f6ebff..3e815cd 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -40,9 +40,7 @@ public:
 public:
   // -- Types
 
-  /**
-   * Search key plus regular expression pair
-   */
+  /** Search key plus regular expression pair.  */
   struct KeyExpT
   {
     KeyExpT() = default;
@@ -63,9 +61,7 @@ public:
     cmsys::RegularExpression Exp;
   };
 
-  /**
-   * Include string with sub parts
-   */
+  /** Include string with sub parts.  */
   struct IncludeKeyT
   {
     IncludeKeyT(std::string const& key, std::size_t basePrefixLength);
@@ -75,9 +71,7 @@ public:
     std::string Base; // Base part of the include file name
   };
 
-  /**
-   * Source file parsing cache
-   */
+  /** Source file parsing cache.  */
   class ParseCacheT
   {
   public:
@@ -127,9 +121,7 @@ public:
     std::unordered_map<std::string, FileHandleT> Map_;
   };
 
-  /**
-   * Source file data
-   */
+  /** Source file data.  */
   class SourceFileT
   {
   public:
@@ -149,9 +141,7 @@ public:
   using SourceFileHandleT = std::shared_ptr<SourceFileT>;
   using SourceFileMapT = std::map<std::string, SourceFileHandleT>;
 
-  /**
-   * Meta compiler file mapping information
-   */
+  /** Meta compiler file mapping information.  */
   struct MappingT
   {
     SourceFileHandleT SourceFile;
@@ -162,9 +152,7 @@ public:
   using MappingHandleT = std::shared_ptr<MappingT>;
   using MappingMapT = std::map<std::string, MappingHandleT>;
 
-  /**
-   * Common settings
-   */
+  /** Common settings.  */
   class BaseSettingsT
   {
   public:
@@ -193,9 +181,7 @@ public:
     std::vector<std::string> HeaderExtensions;
   };
 
-  /**
-   * Shared common variables
-   */
+  /** Shared common variables.  */
   class BaseEvalT
   {
   public:
@@ -209,9 +195,7 @@ public:
     SourceFileMapT Sources;
   };
 
-  /**
-   * Moc settings
-   */
+  /** Moc settings.  */
   class MocSettingsT
   {
   public:
@@ -247,9 +231,7 @@ public:
     cmsys::RegularExpression RegExpInclude;
   };
 
-  /**
-   * Moc shared variables
-   */
+  /** Moc shared variables.  */
   class MocEvalT
   {
   public:
@@ -266,9 +248,7 @@ public:
     std::vector<std::string> CompFiles;
   };
 
-  /**
-   * Uic settings
-   */
+  /** Uic settings.  */
   class UicSettingsT
   {
   public:
@@ -293,9 +273,7 @@ public:
     cmsys::RegularExpression RegExpInclude;
   };
 
-  /**
-   * Uic shared variables
-   */
+  /** Uic shared variables.  */
   class UicEvalT
   {
   public:
@@ -303,15 +281,11 @@ public:
     MappingMapT Includes;
   };
 
-  /**
-   * Abstract job class for concurrent job processing
-   */
+  /** Abstract job class for concurrent job processing.  */
   class JobT : public cmWorkerPool::JobT
   {
   protected:
-    /**
-     * @brief Protected default constructor
-     */
+    /** Protected default constructor.  */
     JobT(bool fence = false)
       : cmWorkerPool::JobT(fence)
     {
@@ -340,17 +314,13 @@ public:
                          std::vector<std::string> const& command,
                          std::string const& output) const;
 
-    /**
-     * @brief Run an external process. Use only during Process() call!
-     */
+    /** @brief Run an external process. Use only during Process() call!  */
     bool RunProcess(GenT genType, cmWorkerPool::ProcessResultT& result,
                     std::vector<std::string> const& command,
                     std::string* infoMessage = nullptr);
   };
 
-  /**
-   * Fence job utility class
-   */
+  /** Fence job utility class.  */
   class JobFenceT : public JobT
   {
   public:
@@ -361,18 +331,14 @@ public:
     void Process() override{};
   };
 
-  /**
-   * Generate moc_predefs.h
-   */
+  /** Generate moc_predefs.h.  */
   class JobMocPredefsT : public JobFenceT
   {
     void Process() override;
     bool Update(std::string* reason) const;
   };
 
-  /**
-   * File parse job base class
-   */
+  /** File parse job base class.  */
   class JobParseT : public JobT
   {
   public:
@@ -396,9 +362,7 @@ public:
     std::string Content;
   };
 
-  /**
-   * Header file parse job
-   */
+  /** Header file parse job.  */
   class JobParseHeaderT : public JobParseT
   {
   public:
@@ -406,9 +370,7 @@ public:
     void Process() override;
   };
 
-  /**
-   * Source file parse job
-   */
+  /** Source file parse job.  */
   class JobParseSourceT : public JobParseT
   {
   public:
@@ -416,10 +378,8 @@ public:
     void Process() override;
   };
 
-  /**
-   * Evaluate parsed files
-   */
-  class JobEvaluateT : public JobFenceT
+  /** Evaluate cached file parse data.  */
+  class JobEvalCacheT : public JobFenceT
   {
     void Process() override;
 
@@ -448,10 +408,8 @@ public:
                             SourceFileHandleT includerFileHandle);
   };
 
-  /**
-   * Generates moc/uic jobs
-   */
-  class JobGenerateT : public JobFenceT
+  /** Probes file dependencies and generates moc and uic compile jobs.  */
+  class JobProbeDepsT : public JobFenceT
   {
     void Process() override;
     // -- Moc
@@ -464,9 +422,7 @@ public:
     bool UicUpdate(MappingT const& mapping, std::string* reason) const;
   };
 
-  /**
-   * File compiling base job
-   */
+  /** Meta compiler base job.  */
   class JobCompileT : public JobT
   {
   public:
@@ -481,36 +437,30 @@ public:
     std::unique_ptr<std::string> Reason;
   };
 
-  /**
-   * moc compiles a file
-   */
-  class JobMocT : public JobCompileT
+  /** moc compiles a file.  */
+  class JobCompileMocT : public JobCompileT
   {
   public:
     using JobCompileT::JobCompileT;
     void Process() override;
   };
 
-  /**
-   * uic compiles a file
-   */
-  class JobUicT : public JobCompileT
+  /** uic compiles a file.  */
+  class JobCompileUicT : public JobCompileT
   {
   public:
     using JobCompileT::JobCompileT;
     void Process() override;
   };
 
-  /// @brief Generate mocs_compilation.cpp
-  ///
+  /** Generate mocs_compilation.cpp.  */
   class JobMocsCompilationT : public JobFenceT
   {
   private:
     void Process() override;
   };
 
-  /// @brief The last job
-  ///
+  /** @brief The last job.  */
   class JobFinishT : public JobFenceT
   {
   private:

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05126d23f6a285731dfef940012c6b78feb9fa62
commit 05126d23f6a285731dfef940012c6b78feb9fa62
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sun Sep 8 15:27:02 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Remove CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE sort duplication
    
    This removes code that sorts include directories for `AUTOMOC` according to
    `CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE`.  This is possible because the
    included directories passed to `AUTOMOC` are already sorted, also with
    respect to `CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE`.

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index c6c71ab..7012ef6 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1247,8 +1247,6 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
               MfDef("CMAKE_CURRENT_SOURCE_DIR"));
     ofs.Write("AM_CMAKE_CURRENT_BINARY_DIR",
               MfDef("CMAKE_CURRENT_BINARY_DIR"));
-    ofs.Write("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE",
-              MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"));
     ofs.Write("AM_BUILD_DIR", this->Dir.Build);
     ofs.Write("AM_INCLUDE_DIR", this->Dir.Include);
     ofs.WriteConfig("AM_INCLUDE_DIR", this->Dir.ConfigInclude);
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 3e30a2f..c305ca6 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2,14 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmQtAutoMocUic.h"
 
-#include <algorithm>
-#include <initializer_list>
-#include <list>
-#include <set>
-#include <utility>
-
-#include "cm_memory.hxx"
-
 #include "cmAlgorithms.h"
 #include "cmCryptoHash.h"
 #include "cmGeneratedFileStream.h"
@@ -17,9 +9,13 @@
 #include "cmQtAutoGen.h"
 #include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
+#include "cm_memory.hxx"
 #include "cmake.h"
 #include "cmsys/FStream.hxx"
 
+#include <algorithm>
+#include <set>
+#include <utility>
 #if defined(__APPLE__)
 #  include <unistd.h>
 #endif
@@ -1545,8 +1541,6 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     makefile->GetCMakeInstance()->GetHeaderExtensions();
 
   // - Files and directories
-  BaseConst_.IncludeProjectDirsBefore =
-    InfoGetBool("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
   BaseConst_.ProjectSourceDir = InfoGet("AM_CMAKE_SOURCE_DIR");
   BaseConst_.ProjectBinaryDir = InfoGet("AM_CMAKE_BINARY_DIR");
   BaseConst_.CurrentSourceDir = InfoGet("AM_CMAKE_CURRENT_SOURCE_DIR");
@@ -1786,35 +1780,6 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
       MocConst_.PredefsFileAbs = AbsoluteBuildPath(MocConst().PredefsFileRel);
     }
 
-    // Sort include directories on demand
-    if (BaseConst().IncludeProjectDirsBefore) {
-      // Move strings to temporary list
-      std::list<std::string> includes(MocConst().IncludePaths.begin(),
-                                      MocConst().IncludePaths.end());
-      MocConst_.IncludePaths.clear();
-      MocConst_.IncludePaths.reserve(includes.size());
-      // Append project directories only
-      {
-        std::initializer_list<cm::string_view> const movePaths = {
-          BaseConst().ProjectBinaryDir, BaseConst().ProjectSourceDir
-        };
-        for (cm::string_view const& ppath : movePaths) {
-          auto it = includes.begin();
-          while (it != includes.end()) {
-            std::string const& path = *it;
-            if (cmHasPrefix(path, ppath)) {
-              MocConst_.IncludePaths.push_back(path);
-              it = includes.erase(it);
-            } else {
-              ++it;
-            }
-          }
-        }
-      }
-      // Append remaining directories
-      MocConst_.IncludePaths.insert(MocConst_.IncludePaths.end(),
-                                    includes.begin(), includes.end());
-    }
     // Compose moc includes list
     {
       std::set<std::string> frameworkPaths;
@@ -1924,7 +1889,6 @@ void cmQtAutoMocUic::SettingsFileRead()
       cha(MocConst().Executable);
       std::for_each(MocConst().AllOptions.begin(), MocConst().AllOptions.end(),
                     cha);
-      cha(BaseConst().IncludeProjectDirsBefore ? "TRUE" : "FALSE");
       std::for_each(MocConst().PredefsCmd.begin(), MocConst().PredefsCmd.end(),
                     cha);
       for (auto const& filter : MocConst().DependFilters) {
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 549b088..2f6ebff 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -178,7 +178,6 @@ public:
     // -- Attributes
     // - Config
     bool MultiConfig = false;
-    bool IncludeProjectDirsBefore = false;
     unsigned int QtVersionMajor = 4;
     // - Directories
     std::string ProjectSourceDir;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f54c5ee52195ae2d73a54faef9399ab977b83a1b
commit f54c5ee52195ae2d73a54faef9399ab977b83a1b
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 13:15:32 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Use CollapseFullPath instead of RealPath to support symbolic links

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 7bf56df..c6c71ab 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -5,6 +5,7 @@
 #include "cmQtAutoGen.h"
 #include "cmQtAutoGenGlobalInitializer.h"
 
+#include "cmAlgorithms.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommandLines.h"
 #include "cmFilePathChecksum.h"
@@ -422,8 +423,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       std::string const deps =
         this->GenTarget->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
       if (!deps.empty()) {
-        std::vector<std::string> extraDeps = cmExpandedList(deps);
-        for (std::string const& depName : extraDeps) {
+        for (std::string const& depName : cmExpandedList(deps)) {
           // Allow target and file dependencies
           auto* depTarget = this->Makefile->FindTargetToUse(depName);
           if (depTarget != nullptr) {
@@ -642,7 +642,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   auto makeMUFile = [this, &kw](cmSourceFile* sf, std::string const& fullPath,
                                 bool muIt) -> MUFileHandle {
     MUFileHandle muf = cm::make_unique<MUFile>();
-    muf->RealPath = cmSystemTools::GetRealPath(fullPath);
+    muf->FullPath = fullPath;
     muf->SF = sf;
     muf->Generated = sf->GetIsGenerated();
     bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN);
@@ -674,7 +674,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
     std::vector<cmSourceFile*> srcFiles;
     this->GenTarget->GetConfigCommonSourceFiles(srcFiles);
     for (cmSourceFile* sf : srcFiles) {
-      // sf->GetExtension() is only valid after sf->GetFullPath() ...
+      // sf->GetExtension() is only valid after sf->ResolveFullPath() ...
       // Since we're iterating over source files that might be not in the
       // target we need to check for path errors (not existing files).
       std::string pathError;
@@ -700,7 +700,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
             !sf->GetPropertyAsBool(kw.SKIP_AUTORCC)) {
           // Register qrc file
           Qrc qrc;
-          qrc.QrcFile = cmSystemTools::GetRealPath(fullPath);
+          qrc.QrcFile = fullPath;
           qrc.QrcName =
             cmSystemTools::GetFilenameWithoutLastExtension(qrc.QrcFile);
           qrc.Generated = sf->GetIsGenerated();
@@ -734,10 +734,10 @@ bool cmQtAutoGenInitializer::InitScanFiles()
       MUFile const& muf = *pair.second;
       if (muf.MocIt || muf.UicIt) {
         // Search for the default header file and a private header
-        std::string const& srcPath = muf.SF->ResolveFullPath();
-        std::string basePath =
-          cmStrCat(cmQtAutoGen::SubDirPrefix(srcPath),
-                   cmSystemTools::GetFilenameWithoutLastExtension(srcPath));
+        std::string const& srcFullPath = muf.SF->ResolveFullPath();
+        std::string basePath = cmStrCat(
+          cmQtAutoGen::SubDirPrefix(srcFullPath),
+          cmSystemTools::GetFilenameWithoutLastExtension(srcFullPath));
         for (auto const& suffix : suffixes) {
           std::string const suffixedPath = cmStrCat(basePath, suffix);
           for (auto const& ext : exts) {
@@ -748,8 +748,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
               this->Makefile->GetSource(fullPath, locationKind);
             if (sf != nullptr) {
               // Check if we know about this header already
-              if (this->AutogenTarget.Headers.find(sf) !=
-                  this->AutogenTarget.Headers.end()) {
+              if (cmContains(this->AutogenTarget.Headers, sf)) {
                 continue;
               }
               // We only accept not-GENERATED files that do exist.
@@ -789,7 +788,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   // at generation time.
   if (this->MocOrUicEnabled()) {
     for (cmSourceFile* sf : this->Makefile->GetSourceFiles()) {
-      // sf->GetExtension() is only valid after sf->GetFullPath() ...
+      // sf->GetExtension() is only valid after sf->ResolveFullPath() ...
       // Since we're iterating over source files that might be not in the
       // target we need to check for path errors (not existing files).
       std::string pathError;
@@ -801,16 +800,14 @@ bool cmQtAutoGenInitializer::InitScanFiles()
         cmSystemTools::LowerCase(sf->GetExtension());
 
       if (cm->IsHeaderExtension(extLower)) {
-        if (this->AutogenTarget.Headers.find(sf) ==
-            this->AutogenTarget.Headers.end()) {
+        if (!cmContains(this->AutogenTarget.Headers, sf)) {
           auto muf = makeMUFile(sf, fullPath, false);
           if (muf->SkipMoc || muf->SkipUic) {
             this->AutogenTarget.Headers.emplace(sf, std::move(muf));
           }
         }
       } else if (cm->IsSourceExtension(extLower)) {
-        if (this->AutogenTarget.Sources.find(sf) ==
-            this->AutogenTarget.Sources.end()) {
+        if (!cmContains(this->AutogenTarget.Headers, sf)) {
           auto muf = makeMUFile(sf, fullPath, false);
           if (muf->SkipMoc || muf->SkipUic) {
             this->AutogenTarget.Sources.emplace(sf, std::move(muf));
@@ -818,7 +815,6 @@ bool cmQtAutoGenInitializer::InitScanFiles()
         }
       } else if (this->Uic.Enabled && (extLower == kw.ui)) {
         // .ui file
-        std::string realPath = cmSystemTools::GetRealPath(fullPath);
         bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN);
         bool const skipUic =
           (skipAutogen || sf->GetPropertyAsBool(kw.SKIP_AUTOUIC));
@@ -826,13 +822,12 @@ bool cmQtAutoGenInitializer::InitScanFiles()
           // Check if the .ui file has uic options
           std::string const uicOpts = sf->GetSafeProperty(kw.AUTOUIC_OPTIONS);
           if (!uicOpts.empty()) {
-            this->Uic.FileFiles.push_back(std::move(realPath));
-            std::vector<std::string> optsVec = cmExpandedList(uicOpts);
-            this->Uic.FileOptions.push_back(std::move(optsVec));
+            this->Uic.FileFiles.push_back(fullPath);
+            this->Uic.FileOptions.push_back(cmExpandedList(uicOpts));
           }
         } else {
           // Register skipped .ui file
-          this->Uic.SkipUi.insert(std::move(realPath));
+          this->Uic.SkipUi.insert(fullPath);
         }
       }
     }
@@ -843,7 +838,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
     if (this->CMP0071Accept) {
       // Let the autogen target depend on the GENERATED files
       for (MUFile* muf : this->AutogenTarget.FilesGenerated) {
-        this->AutogenTarget.DependFiles.insert(muf->RealPath);
+        this->AutogenTarget.DependFiles.insert(muf->FullPath);
       }
     } else if (this->CMP0071Warn) {
       cm::string_view property;
@@ -856,7 +851,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
       }
       std::string files;
       for (MUFile* muf : this->AutogenTarget.FilesGenerated) {
-        files += cmStrCat("  ", Quoted(muf->RealPath), '\n');
+        files += cmStrCat("  ", Quoted(muf->FullPath), '\n');
       }
       this->Makefile->IssueMessage(
         MessageType::AUTHOR_WARNING,
@@ -1280,7 +1275,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
         }
         std::sort(sortedHeaders.begin(), sortedHeaders.end(),
                   [](MUFile const* a, MUFile const* b) {
-                    return (a->RealPath < b->RealPath);
+                    return (a->FullPath < b->FullPath);
                   });
       }
 
@@ -1289,13 +1284,13 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
           continue;
         }
         if (muf->SkipMoc) {
-          moc_skip.insert(muf->RealPath);
+          moc_skip.insert(muf->FullPath);
         }
         if (muf->SkipUic) {
-          uic_skip.insert(muf->RealPath);
+          uic_skip.insert(muf->FullPath);
         }
         if (muf->MocIt || muf->UicIt) {
-          headers.emplace_back(muf->RealPath);
+          headers.emplace_back(muf->FullPath);
           headersFlags.emplace_back(
             cmStrCat(muf->MocIt ? 'M' : 'm', muf->UicIt ? 'U' : 'u'));
         }
@@ -1334,7 +1329,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
       }
       std::sort(sorted.begin(), sorted.end(),
                 [](MUFile const* a, MUFile const* b) {
-                  return (a->RealPath < b->RealPath);
+                  return (a->FullPath < b->FullPath);
                 });
 
       for (MUFile const* const muf : sorted) {
@@ -1342,13 +1337,13 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
           continue;
         }
         if (muf->SkipMoc) {
-          moc_skip.insert(muf->RealPath);
+          moc_skip.insert(muf->FullPath);
         }
         if (muf->SkipUic) {
-          uic_skip.insert(muf->RealPath);
+          uic_skip.insert(muf->FullPath);
         }
         if (muf->MocIt || muf->UicIt) {
-          sources.emplace_back(muf->RealPath);
+          sources.emplace_back(muf->FullPath);
           sourcesFlags.emplace_back(
             cmStrCat(muf->MocIt ? 'M' : 'm', muf->UicIt ? 'U' : 'u'));
         }
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index d8d4dff..bedda30 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -50,7 +50,7 @@ public:
   /// @brief Moc/Uic file
   struct MUFile
   {
-    std::string RealPath;
+    std::string FullPath;
     cmSourceFile* SF = nullptr;
     bool Generated = false;
     bool SkipMoc = false;
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 40ebdde..3e30a2f 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -838,7 +838,8 @@ cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvaluateT::MocFindHeader(
     cmFileTime fileTime;
     if (fileTime.Load(testPath)) {
       // Compute real path of the file
-      testPath = cmSystemTools::GetRealPath(testPath);
+      testPath = cmSystemTools::CollapseFullPath(testPath,
+                                                 BaseConst().CurrentSourceDir);
       // Return a known file if it exists already
       {
         auto it = BaseEval().Headers.find(testPath);
@@ -1057,12 +1058,13 @@ cmQtAutoMocUic::JobEvaluateT::UicFindIncludedUi(
     cmFileTime fileTime;
     if (fileTime.Load(testFile)) {
       // .ui file found in files system!
-      std::string realPath = cmSystemTools::GetRealPath(testFile);
+      std::string fullPath = cmSystemTools::CollapseFullPath(
+        testFile, BaseConst().CurrentSourceDir);
       // Get or create .ui file handle
-      SourceFileHandleT& handle = Gen()->UicEval().UiFiles[realPath];
+      SourceFileHandleT& handle = Gen()->UicEval().UiFiles[fullPath];
       if (!handle) {
         // The file wasn't registered, yet
-        handle = std::make_shared<SourceFileT>(realPath);
+        handle = std::make_shared<SourceFileT>(fullPath);
         handle->FileTime = fileTime;
       }
       return handle;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65c49e0e26488931e6ec27a1d352c07d43171f22
commit 65c49e0e26488931e6ec27a1d352c07d43171f22
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 10:28:14 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Sanitize include and search directories

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index a5fc5e3..7bf56df 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -122,6 +122,41 @@ bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
   }
   return cycle;
 }
+
+/** Sanitizes file search paths */
+class SearchPathSanitizer
+{
+public:
+  SearchPathSanitizer(cmMakefile* makefile)
+    : SourcePath_(makefile->GetCurrentSourceDirectory())
+  {
+  }
+  std::vector<std::string> operator()(
+    std::vector<std::string> const& paths) const;
+
+private:
+  std::string SourcePath_;
+};
+
+std::vector<std::string> SearchPathSanitizer::operator()(
+  std::vector<std::string> const& paths) const
+{
+  std::vector<std::string> res;
+  res.reserve(paths.size());
+  for (std::string const& srcPath : paths) {
+    // Collapse relative paths
+    std::string path = cmSystemTools::CollapseFullPath(srcPath, SourcePath_);
+    // Remove suffix slashes
+    while (cmHasSuffix(path, '/')) {
+      path.pop_back();
+    }
+    // Accept only non empty paths
+    if (!path.empty()) {
+      res.emplace_back(std::move(path));
+    }
+  }
+  return res;
+}
 } // End of unnamed namespace
 
 cmQtAutoGenInitializer::InfoWriter::InfoWriter(std::string const& filename)
@@ -456,16 +491,16 @@ bool cmQtAutoGenInitializer::InitMoc()
 
   // Moc includes
   {
+    SearchPathSanitizer sanitizer(this->Makefile);
     auto GetIncludeDirs =
-      [this](std::string const& cfg) -> std::vector<std::string> {
+      [this, &sanitizer](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
+      // include dirs off, see issue #13667.
       std::vector<std::string> dirs;
       bool const appendImplicit = (this->QtVersion.Major >= 5);
       this->LocalGen->GetIncludeDirectoriesImplicit(
         dirs, this->GenTarget, "CXX", cfg, false, appendImplicit);
-      return dirs;
+      return sanitizer(dirs);
     };
 
     // Default configuration include directories
@@ -531,11 +566,8 @@ bool cmQtAutoGenInitializer::InitUic()
     std::string const usp =
       this->GenTarget->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
     if (!usp.empty()) {
-      cmExpandList(usp, this->Uic.SearchPaths);
-      std::string const& srcDir = this->Makefile->GetCurrentSourceDirectory();
-      for (std::string& path : this->Uic.SearchPaths) {
-        path = cmSystemTools::CollapseFullPath(path, srcDir);
-      }
+      this->Uic.SearchPaths =
+        SearchPathSanitizer(this->Makefile)(cmExpandedList(usp));
     }
   }
   // Uic target options

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dad1a6b3fbf1c9d34a6d2e5722e426234bbb5df0
commit dad1a6b3fbf1c9d34a6d2e5722e426234bbb5df0
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 09:56:41 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:48 2019 +0200

    Autogen: Modernize by using an unnamed namespace instead of static functions

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index bf20638..a5fc5e3 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -42,7 +42,9 @@
 
 #include "cm_memory.hxx"
 
-static std::size_t GetParallelCPUCount()
+namespace {
+
+std::size_t GetParallelCPUCount()
 {
   static std::size_t count = 0;
   // Detect only on the first call
@@ -56,8 +58,8 @@ static std::size_t GetParallelCPUCount()
   return count;
 }
 
-static std::string FileProjectRelativePath(cmMakefile* makefile,
-                                           std::string const& fileName)
+std::string FileProjectRelativePath(cmMakefile* makefile,
+                                    std::string const& fileName)
 {
   std::string res;
   {
@@ -81,9 +83,9 @@ static std::string FileProjectRelativePath(cmMakefile* makefile,
  * recursive STATIC_LIBRARY dependencies depends on targetOrigin
  * (STATIC_LIBRARY cycle).
  */
-static bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
-                               cmGeneratorTarget const* targetDepend,
-                               std::string const& config)
+bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
+                        cmGeneratorTarget const* targetDepend,
+                        std::string const& config)
 {
   bool cycle = false;
   if ((targetOrigin->GetType() == cmStateEnums::STATIC_LIBRARY) &&
@@ -120,6 +122,7 @@ static bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
   }
   return cycle;
 }
+} // End of unnamed namespace
 
 cmQtAutoGenInitializer::InfoWriter::InfoWriter(std::string const& filename)
 {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82096911461f37f0421a7a79faa179aa9e0cb25c
commit 82096911461f37f0421a7a79faa179aa9e0cb25c
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Sep 12 10:19:37 2019 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Mon Sep 16 18:18:44 2019 +0200

    Autogen: Compute and store generator pointers once in initializer constructor

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 54304c3..bf20638 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1,6 +1,7 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmQtAutoGenInitializer.h"
+
 #include "cmQtAutoGen.h"
 #include "cmQtAutoGenGlobalInitializer.h"
 
@@ -213,11 +214,15 @@ void cmQtAutoGenInitializer::InfoWriter::WriteNestedLists(
 };
 
 cmQtAutoGenInitializer::cmQtAutoGenInitializer(
-  cmQtAutoGenGlobalInitializer* globalInitializer, cmGeneratorTarget* target,
-  IntegerVersion const& qtVersion, bool mocEnabled, bool uicEnabled,
-  bool rccEnabled, bool globalAutogenTarget, bool globalAutoRccTarget)
+  cmQtAutoGenGlobalInitializer* globalInitializer,
+  cmGeneratorTarget* genTarget, IntegerVersion const& qtVersion,
+  bool mocEnabled, bool uicEnabled, bool rccEnabled, bool globalAutogenTarget,
+  bool globalAutoRccTarget)
   : GlobalInitializer(globalInitializer)
-  , Target(target)
+  , GenTarget(genTarget)
+  , GlobalGen(genTarget->GetGlobalGenerator())
+  , LocalGen(genTarget->GetLocalGenerator())
+  , Makefile(genTarget->Makefile)
   , QtVersion(qtVersion)
 {
   AutogenTarget.GlobalTarget = globalAutogenTarget;
@@ -229,19 +234,15 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer(
 
 bool cmQtAutoGenInitializer::InitCustomTargets()
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-  cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
-  cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
-
   // Configurations
-  this->MultiConfig = globalGen->IsMultiConfig();
-  this->ConfigDefault = makefile->GetConfigurations(this->ConfigsList);
+  this->MultiConfig = this->GlobalGen->IsMultiConfig();
+  this->ConfigDefault = this->Makefile->GetConfigurations(this->ConfigsList);
   if (this->ConfigsList.empty()) {
     this->ConfigsList.push_back(this->ConfigDefault);
   }
 
   // Verbosity
-  this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE");
+  this->Verbosity = this->Makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE");
   if (!this->Verbosity.empty()) {
     unsigned long iVerb = 0;
     if (!cmStrToULong(this->Verbosity, &iVerb)) {
@@ -253,14 +254,14 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
   // Targets FOLDER
   {
     const char* folder =
-      makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
+      this->Makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
     if (folder == nullptr) {
-      folder =
-        makefile->GetState()->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER");
+      folder = this->Makefile->GetState()->GetGlobalProperty(
+        "AUTOGEN_TARGETS_FOLDER");
     }
     // Inherit FOLDER property from target (#13688)
     if (folder == nullptr) {
-      folder = this->Target->GetProperty("FOLDER");
+      folder = this->GenTarget->GetProperty("FOLDER");
     }
     if (folder != nullptr) {
       this->TargetsFolder = folder;
@@ -270,7 +271,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
   // Check status of policy CMP0071
   {
     cmPolicies::PolicyStatus const CMP0071_status =
-      makefile->GetPolicyStatus(cmPolicies::CMP0071);
+      this->Makefile->GetPolicyStatus(cmPolicies::CMP0071);
     switch (CMP0071_status) {
       case cmPolicies::WARN:
         this->CMP0071Warn = true;
@@ -291,18 +292,18 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
   {
     // Collapsed current binary directory
     std::string const cbd = cmSystemTools::CollapseFullPath(
-      std::string(), makefile->GetCurrentBinaryDirectory());
+      std::string(), this->Makefile->GetCurrentBinaryDirectory());
 
     // Info directory
-    this->Dir.Info =
-      cmStrCat(cbd, "/CMakeFiles/", this->Target->GetName(), "_autogen.dir");
+    this->Dir.Info = cmStrCat(cbd, "/CMakeFiles/", this->GenTarget->GetName(),
+                              "_autogen.dir");
     cmSystemTools::ConvertToUnixSlashes(this->Dir.Info);
 
     // Build directory
-    this->Dir.Build = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR");
+    this->Dir.Build = this->GenTarget->GetSafeProperty("AUTOGEN_BUILD_DIR");
     if (this->Dir.Build.empty()) {
       this->Dir.Build =
-        cmStrCat(cbd, '/', this->Target->GetName(), "_autogen");
+        cmStrCat(cbd, '/', this->GenTarget->GetName(), "_autogen");
     }
     cmSystemTools::ConvertToUnixSlashes(this->Dir.Build);
     // Cleanup build directory
@@ -339,11 +340,12 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     }
 
     // Autogen target name
-    this->AutogenTarget.Name = cmStrCat(this->Target->GetName(), "_autogen");
+    this->AutogenTarget.Name =
+      cmStrCat(this->GenTarget->GetName(), "_autogen");
 
     // Autogen target parallel processing
     this->AutogenTarget.Parallel =
-      this->Target->GetSafeProperty("AUTOGEN_PARALLEL");
+      this->GenTarget->GetSafeProperty("AUTOGEN_PARALLEL");
     if (this->AutogenTarget.Parallel.empty() ||
         (this->AutogenTarget.Parallel == "AUTO")) {
       // Autodetect number of CPUs
@@ -377,15 +379,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     // Autogen target: Compute user defined dependencies
     {
       this->AutogenTarget.DependOrigin =
-        this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
+        this->GenTarget->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
 
       std::string const deps =
-        this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
+        this->GenTarget->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
       if (!deps.empty()) {
         std::vector<std::string> extraDeps = cmExpandedList(deps);
         for (std::string const& depName : extraDeps) {
           // Allow target and file dependencies
-          auto* depTarget = makefile->FindTargetToUse(depName);
+          auto* depTarget = this->Makefile->FindTargetToUse(depName);
           if (depTarget != nullptr) {
             this->AutogenTarget.DependTargets.insert(depTarget);
           } else {
@@ -397,13 +399,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
 
     // CMAKE_AUTOMOC_RELAXED_MODE deprecation warning
     if (this->Moc.Enabled) {
-      if (makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE")) {
-        makefile->IssueMessage(
+      if (this->Makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE")) {
+        this->Makefile->IssueMessage(
           MessageType::AUTHOR_WARNING,
           cmStrCat("AUTOMOC: CMAKE_AUTOMOC_RELAXED_MODE is "
                    "deprecated an will be removed in the future.  Consider "
                    "disabling it and converting the target ",
-                   this->Target->GetName(), " to regular mode."));
+                   this->GenTarget->GetName(), " to regular mode."));
       }
     }
   }
@@ -415,7 +417,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
 
   // Add autogen include directory to the origin target INCLUDE_DIRECTORIES
   if (this->MocOrUicEnabled() || (this->Rcc.Enabled && this->MultiConfig)) {
-    this->Target->AddIncludeDirectory(this->Dir.Include, true);
+    this->GenTarget->AddIncludeDirectory(this->Dir.Include, true);
   }
 
   // Scan files
@@ -438,32 +440,28 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
 
 bool cmQtAutoGenInitializer::InitMoc()
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-  cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
-
   // Mocs compilation file
   this->Moc.MocsCompilation =
     cmStrCat(this->Dir.Build, "/mocs_compilation.cpp");
 
   // Moc predefs command
-  if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") &&
+  if (this->GenTarget->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") &&
       (this->QtVersion >= IntegerVersion(5, 8))) {
-    this->Moc.PredefsCmd =
-      makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND");
+    this->Moc.PredefsCmd = this->Makefile->GetSafeDefinition(
+      "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND");
   }
 
   // Moc includes
   {
-    bool const appendImplicit = (this->QtVersion.Major >= 5);
     auto GetIncludeDirs =
-      [this, localGen,
-       appendImplicit](std::string const& cfg) -> std::vector<std::string> {
+      [this](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
       std::vector<std::string> dirs;
-      localGen->GetIncludeDirectoriesImplicit(dirs, this->Target, "CXX", cfg,
-                                              false, appendImplicit);
+      bool const appendImplicit = (this->QtVersion.Major >= 5);
+      this->LocalGen->GetIncludeDirectoriesImplicit(
+        dirs, this->GenTarget, "CXX", cfg, false, appendImplicit);
       return dirs;
     };
 
@@ -483,9 +481,9 @@ bool cmQtAutoGenInitializer::InitMoc()
   // Moc compile definitions
   {
     auto GetCompileDefinitions =
-      [this, localGen](std::string const& cfg) -> std::set<std::string> {
+      [this](std::string const& cfg) -> std::set<std::string> {
       std::set<std::string> defines;
-      localGen->GetTargetDefines(this->Target, cfg, "CXX", defines);
+      this->LocalGen->GetTargetDefines(this->GenTarget, cfg, "CXX", defines);
 #ifdef _WIN32
       if (this->Moc.PredefsCmd.empty()) {
         // Add WIN32 definition if we don't have a moc_predefs.h
@@ -525,15 +523,13 @@ bool cmQtAutoGenInitializer::InitMoc()
 
 bool cmQtAutoGenInitializer::InitUic()
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-
   // Uic search paths
   {
     std::string const usp =
-      this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
+      this->GenTarget->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
     if (!usp.empty()) {
       cmExpandList(usp, this->Uic.SearchPaths);
-      std::string const& srcDir = makefile->GetCurrentSourceDirectory();
+      std::string const& srcDir = this->Makefile->GetCurrentSourceDirectory();
       for (std::string& path : this->Uic.SearchPaths) {
         path = cmSystemTools::CollapseFullPath(path, srcDir);
       }
@@ -544,7 +540,7 @@ bool cmQtAutoGenInitializer::InitUic()
     auto UicGetOpts =
       [this](std::string const& cfg) -> std::vector<std::string> {
       std::vector<std::string> opts;
-      this->Target->GetAutoUicOptions(opts, cfg);
+      this->GenTarget->GetAutoUicOptions(opts, cfg);
       return opts;
     };
 
@@ -605,8 +601,7 @@ bool cmQtAutoGenInitializer::InitRcc()
 
 bool cmQtAutoGenInitializer::InitScanFiles()
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-  cmake const* cm = makefile->GetCMakeInstance();
+  cmake const* cm = this->Makefile->GetCMakeInstance();
   auto const& kw = this->GlobalInitializer->kw();
 
   auto makeMUFile = [this, &kw](cmSourceFile* sf, std::string const& fullPath,
@@ -642,7 +637,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   {
     // Scan through target files
     std::vector<cmSourceFile*> srcFiles;
-    this->Target->GetConfigCommonSourceFiles(srcFiles);
+    this->GenTarget->GetConfigCommonSourceFiles(srcFiles);
     for (cmSourceFile* sf : srcFiles) {
       // sf->GetExtension() is only valid after sf->GetFullPath() ...
       // Since we're iterating over source files that might be not in the
@@ -690,7 +685,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   // sources meta data cache. Clear it so that OBJECT library targets that
   // are AUTOGEN initialized after this target get their added
   // mocs_compilation.cpp source acknowledged by this target.
-  this->Target->ClearSourcesCache();
+  this->GenTarget->ClearSourcesCache();
 
   // For source files find additional headers and private headers
   if (this->MocOrUicEnabled()) {
@@ -714,7 +709,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
             std::string fullPath = cmStrCat(suffixedPath, '.', ext);
 
             auto constexpr locationKind = cmSourceFileLocationKind::Known;
-            cmSourceFile* sf = makefile->GetSource(fullPath, locationKind);
+            cmSourceFile* sf =
+              this->Makefile->GetSource(fullPath, locationKind);
             if (sf != nullptr) {
               // Check if we know about this header already
               if (this->AutogenTarget.Headers.find(sf) !=
@@ -728,7 +724,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
               }
             } else if (cmSystemTools::FileExists(fullPath)) {
               // Create a new source file for the existing file
-              sf = makefile->CreateSource(fullPath, false, locationKind);
+              sf = this->Makefile->CreateSource(fullPath, false, locationKind);
             }
 
             if (sf != nullptr) {
@@ -757,7 +753,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   // The reason is that their file names might be discovered from source files
   // at generation time.
   if (this->MocOrUicEnabled()) {
-    for (cmSourceFile* sf : makefile->GetSourceFiles()) {
+    for (cmSourceFile* sf : this->Makefile->GetSourceFiles()) {
       // sf->GetExtension() is only valid after sf->GetFullPath() ...
       // Since we're iterating over source files that might be not in the
       // target we need to check for path errors (not existing files).
@@ -827,7 +823,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
       for (MUFile* muf : this->AutogenTarget.FilesGenerated) {
         files += cmStrCat("  ", Quoted(muf->RealPath), '\n');
       }
-      makefile->IssueMessage(
+      this->Makefile->IssueMessage(
         MessageType::AUTHOR_WARNING,
         cmStrCat(
           cmPolicies::GetPolicyWarning(cmPolicies::CMP0071), '\n',
@@ -848,7 +844,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
     const bool modernQt = (this->QtVersion.Major >= 5);
     // Target rcc options
     std::vector<std::string> optionsTarget =
-      cmExpandedList(this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS));
+      cmExpandedList(this->GenTarget->GetSafeProperty(kw.AUTORCC_OPTIONS));
 
     // Check if file name is unique
     for (Qrc& qrc : this->Rcc.Qrcs) {
@@ -862,7 +858,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
     }
     // Path checksum and file names
     {
-      cmFilePathChecksum const fpathCheckSum(makefile);
+      cmFilePathChecksum const fpathCheckSum(this->Makefile);
       for (Qrc& qrc : this->Rcc.Qrcs) {
         qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile);
         // RCC output file name
@@ -925,12 +921,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
 
 bool cmQtAutoGenInitializer::InitAutogenTarget()
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-  cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
-  cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
-
   // Register info file as generated by CMake
-  makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile);
+  this->Makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile);
 
   // Files provided by the autogen target
   std::vector<std::string> autogenProvides;
@@ -952,8 +944,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
       }
       tools += "UIC";
     }
-    autogenComment =
-      cmStrCat("Automatic ", tools, " for target ", this->Target->GetName());
+    autogenComment = cmStrCat("Automatic ", tools, " for target ",
+                              this->GenTarget->GetName());
   }
 
   // Compose command lines
@@ -970,7 +962,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
 
   // Use PRE_BUILD on demand
   bool usePRE_BUILD = false;
-  if (globalGen->GetName().find("Visual Studio") != std::string::npos) {
+  if (this->GlobalGen->GetName().find("Visual Studio") != std::string::npos) {
     // Under VS use a PRE_BUILD event instead of a separate target to
     // reduce the number of targets loaded into the IDE.
     // This also works around a VS 11 bug that may skip updating the target:
@@ -992,7 +984,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
   if (usePRE_BUILD) {
     // Add additional autogen target dependencies to origin target
     for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
-      this->Target->Target->AddUtility(depTarget->GetName(), makefile);
+      this->GenTarget->Target->AddUtility(depTarget->GetName(),
+                                          this->Makefile);
     }
 
     // Add the pre-build command directly to bypass the OBJECT_LIBRARY
@@ -1002,12 +995,12 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
     // PRE_BUILD does not support file dependencies!
     const std::vector<std::string> no_output;
     const std::vector<std::string> no_deps;
-    cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps,
+    cmCustomCommand cc(this->Makefile, no_output, autogenProvides, no_deps,
                        commandLines, autogenComment.c_str(),
                        this->Dir.Work.c_str());
     cc.SetEscapeOldStyle(false);
     cc.SetEscapeAllowMakeVars(true);
-    this->Target->Target->AddPreBuildCommand(cc);
+    this->GenTarget->Target->AddPreBuildCommand(cc);
   } else {
 
     // Add link library target dependencies to the autogen target
@@ -1018,12 +1011,12 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
       std::map<cmGeneratorTarget const*, std::size_t> commonTargets;
       for (std::string const& config : this->ConfigsList) {
         cmLinkImplementationLibraries const* libs =
-          this->Target->GetLinkImplementationLibraries(config);
+          this->GenTarget->GetLinkImplementationLibraries(config);
         if (libs != nullptr) {
           for (cmLinkItem const& item : libs->Libraries) {
             cmGeneratorTarget const* libTarget = item.Target;
             if ((libTarget != nullptr) &&
-                !StaticLibraryCycle(this->Target, libTarget, config)) {
+                !StaticLibraryCycle(this->GenTarget, libTarget, config)) {
               // Increment target config count
               commonTargets[libTarget]++;
             }
@@ -1038,25 +1031,25 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
     }
 
     // Create autogen target
-    cmTarget* autogenTarget = makefile->AddUtilityCommand(
+    cmTarget* autogenTarget = this->Makefile->AddUtilityCommand(
       this->AutogenTarget.Name, cmMakefile::TargetOrigin::Generator, true,
       this->Dir.Work.c_str(), /*byproducts=*/autogenProvides,
       std::vector<std::string>(this->AutogenTarget.DependFiles.begin(),
                                this->AutogenTarget.DependFiles.end()),
       commandLines, false, autogenComment.c_str());
     // Create autogen generator target
-    localGen->AddGeneratorTarget(
-      new cmGeneratorTarget(autogenTarget, localGen));
+    this->LocalGen->AddGeneratorTarget(
+      new cmGeneratorTarget(autogenTarget, this->LocalGen));
 
     // Forward origin utilities to autogen target
     if (this->AutogenTarget.DependOrigin) {
-      for (BT<std::string> const& depName : this->Target->GetUtilities()) {
-        autogenTarget->AddUtility(depName.Value, makefile);
+      for (BT<std::string> const& depName : this->GenTarget->GetUtilities()) {
+        autogenTarget->AddUtility(depName.Value, this->Makefile);
       }
     }
     // Add additional autogen target dependencies to autogen target
     for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
-      autogenTarget->AddUtility(depTarget->GetName(), makefile);
+      autogenTarget->AddUtility(depTarget->GetName(), this->Makefile);
     }
 
     // Set FOLDER property in autogen target
@@ -1065,11 +1058,12 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
     }
 
     // Add autogen target to the origin target dependencies
-    this->Target->Target->AddUtility(this->AutogenTarget.Name, makefile);
+    this->GenTarget->Target->AddUtility(this->AutogenTarget.Name,
+                                        this->Makefile);
 
     // Add autogen target to the global autogen target dependencies
     if (this->AutogenTarget.GlobalTarget) {
-      this->GlobalInitializer->AddToGlobalAutoGen(localGen,
+      this->GlobalInitializer->AddToGlobalAutoGen(this->LocalGen,
                                                   this->AutogenTarget.Name);
     }
   }
@@ -1079,12 +1073,9 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
 
 bool cmQtAutoGenInitializer::InitRccTargets()
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-  cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
-
   for (Qrc const& qrc : this->Rcc.Qrcs) {
     // Register info file as generated by CMake
-    makefile->AddCMakeOutputFile(qrc.InfoFile);
+    this->Makefile->AddCMakeOutputFile(qrc.InfoFile);
     // Register file at target
     this->AddGeneratedSource(qrc.RccFile, this->Rcc);
 
@@ -1117,41 +1108,43 @@ bool cmQtAutoGenInitializer::InitRccTargets()
       currentLine.push_back("$<CONFIG>");
       commandLines.push_back(std::move(currentLine));
     }
-    std::string ccComment = cmStrCat(
-      "Automatic RCC for ", FileProjectRelativePath(makefile, qrc.QrcFile));
+    std::string ccComment =
+      cmStrCat("Automatic RCC for ",
+               FileProjectRelativePath(this->Makefile, qrc.QrcFile));
 
     if (qrc.Generated || this->Rcc.GlobalTarget) {
       // Create custom rcc target
       std::string ccName;
       {
-        ccName = cmStrCat(this->Target->GetName(), "_arcc_", qrc.QrcName);
+        ccName = cmStrCat(this->GenTarget->GetName(), "_arcc_", qrc.QrcName);
         if (!qrc.Unique) {
           ccName += cmStrCat('_', qrc.PathChecksum);
         }
 
-        cmTarget* autoRccTarget = makefile->AddUtilityCommand(
+        cmTarget* autoRccTarget = this->Makefile->AddUtilityCommand(
           ccName, cmMakefile::TargetOrigin::Generator, true,
           this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false,
           ccComment.c_str());
 
         // Create autogen generator target
-        localGen->AddGeneratorTarget(
-          new cmGeneratorTarget(autoRccTarget, localGen));
+        this->LocalGen->AddGeneratorTarget(
+          new cmGeneratorTarget(autoRccTarget, this->LocalGen));
 
         // Set FOLDER property in autogen target
         if (!this->TargetsFolder.empty()) {
           autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
         }
         if (!this->Rcc.ExecutableTargetName.empty()) {
-          autoRccTarget->AddUtility(this->Rcc.ExecutableTargetName, makefile);
+          autoRccTarget->AddUtility(this->Rcc.ExecutableTargetName,
+                                    this->Makefile);
         }
       }
       // Add autogen target to the origin target dependencies
-      this->Target->Target->AddUtility(ccName, makefile);
+      this->GenTarget->Target->AddUtility(ccName, this->Makefile);
 
       // Add autogen target to the global autogen target dependencies
       if (this->Rcc.GlobalTarget) {
-        this->GlobalInitializer->AddToGlobalAutoRcc(localGen, ccName);
+        this->GlobalInitializer->AddToGlobalAutoRcc(this->LocalGen, ccName);
       }
     } else {
       // Create custom rcc command
@@ -1168,13 +1161,13 @@ bool cmQtAutoGenInitializer::InitRccTargets()
         }
         std::string no_main_dependency;
         cmImplicitDependsList no_implicit_depends;
-        makefile->AddCustomCommandToOutput(
+        this->Makefile->AddCustomCommandToOutput(
           ccOutput, ccByproducts, ccDepends, no_main_dependency,
           no_implicit_depends, commandLines, ccComment.c_str(),
           this->Dir.Work.c_str());
       }
       // Reconfigure when .qrc file changes
-      makefile->AddCMakeDependFile(qrc.QrcFile);
+      this->Makefile->AddCMakeDependFile(qrc.QrcFile);
     }
   }
 
@@ -1207,9 +1200,8 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
   InfoWriter ofs(this->AutogenTarget.InfoFile);
   if (ofs) {
     // Utility lambdas
-    cmMakefile* makefile = this->Target->Target->GetMakefile();
-    auto MfDef = [makefile](const char* key) {
-      return makefile->GetSafeDefinition(key);
+    auto MfDef = [this](const char* key) {
+      return this->Makefile->GetSafeDefinition(key);
     };
 
     // Write common settings
@@ -1276,7 +1268,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
     }
     // Header build paths
     {
-      cmFilePathChecksum const fpathCheckSum(makefile);
+      cmFilePathChecksum const fpathCheckSum(this->Makefile);
       std::unordered_set<std::string> emitted;
       for (std::string const& hdr : headers) {
         std::string const basePath =
@@ -1354,12 +1346,12 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
       ofs.WriteStrings("AM_MOC_INCLUDES", this->Moc.Includes);
       ofs.WriteConfigStrings("AM_MOC_INCLUDES", this->Moc.ConfigIncludes);
       ofs.Write("AM_MOC_OPTIONS",
-                this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS"));
+                this->GenTarget->GetSafeProperty("AUTOMOC_MOC_OPTIONS"));
       ofs.Write("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE"));
       ofs.Write("AM_MOC_MACRO_NAMES",
-                this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES"));
+                this->GenTarget->GetSafeProperty("AUTOMOC_MACRO_NAMES"));
       ofs.Write("AM_MOC_DEPEND_FILTERS",
-                this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS"));
+                this->GenTarget->GetSafeProperty("AUTOMOC_DEPEND_FILTERS"));
       ofs.Write("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd);
     }
 
@@ -1429,8 +1421,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
 void cmQtAutoGenInitializer::RegisterGeneratedSource(
   std::string const& filename)
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
-  cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
+  cmSourceFile* gFile = this->Makefile->GetOrCreateSource(filename, true);
   gFile->SetProperty("GENERATED", "1");
   gFile->SetProperty("SKIP_AUTOGEN", "1");
 }
@@ -1442,7 +1433,7 @@ bool cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
   // Register source at makefile
   this->RegisterGeneratedSource(filename);
   // Add source file to target
-  this->Target->AddSource(filename, prepend);
+  this->GenTarget->AddSource(filename, prepend);
   // Add source file to source group
   return this->AddToSourceGroup(filename, genVars.GenNameUpper);
 }
@@ -1450,7 +1441,6 @@ bool cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
 bool cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
                                               cm::string_view genNameUpper)
 {
-  cmMakefile* makefile = this->Target->Target->GetMakefile();
   cmSourceGroup* sourceGroup = nullptr;
   // Acquire source group
   {
@@ -1462,7 +1452,8 @@ bool cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
         cmStrCat(genNameUpper, "_SOURCE_GROUP"), "AUTOGEN_SOURCE_GROUP"
       };
       for (std::string const& prop : props) {
-        const char* propName = makefile->GetState()->GetGlobalProperty(prop);
+        const char* propName =
+          this->Makefile->GetState()->GetGlobalProperty(prop);
         if ((propName != nullptr) && (*propName != '\0')) {
           groupName = propName;
           property = prop;
@@ -1472,7 +1463,7 @@ bool cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
     }
     // Generate a source group on demand
     if (!groupName.empty()) {
-      sourceGroup = makefile->GetOrCreateSourceGroup(groupName);
+      sourceGroup = this->Makefile->GetOrCreateSourceGroup(groupName);
       if (sourceGroup == nullptr) {
         cmSystemTools::Error(
           cmStrCat(genNameUpper, " error in ", property,
@@ -1490,8 +1481,8 @@ bool cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
 
 void cmQtAutoGenInitializer::AddCleanFile(std::string const& fileName)
 {
-  Target->Target->AppendProperty("ADDITIONAL_CLEAN_FILES", fileName.c_str(),
-                                 false);
+  this->GenTarget->Target->AppendProperty("ADDITIONAL_CLEAN_FILES",
+                                          fileName.c_str(), false);
 }
 
 static unsigned int CharPtrToUInt(const char* const input)
@@ -1504,7 +1495,7 @@ static unsigned int CharPtrToUInt(const char* const input)
 }
 
 static std::vector<cmQtAutoGen::IntegerVersion> GetKnownQtVersions(
-  cmGeneratorTarget const* target)
+  cmGeneratorTarget const* genTarget)
 {
   // Qt version variable prefixes
   static std::initializer_list<
@@ -1526,7 +1517,7 @@ static std::vector<cmQtAutoGen::IntegerVersion> GetKnownQtVersions(
     }
   };
 
-  cmMakefile* makefile = target->Target->GetMakefile();
+  cmMakefile* makefile = genTarget->Makefile;
 
   // Read versions from variables
   for (auto const& keyPair : keys) {
@@ -1576,22 +1567,20 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
 {
   auto print_err = [this, &genVars](std::string const& err) {
     cmSystemTools::Error(cmStrCat(genVars.GenNameUpper, " for target ",
-                                  this->Target->GetName(), ": ", err));
+                                  this->GenTarget->GetName(), ": ", err));
   };
 
   // Custom executable
   {
     std::string const prop = cmStrCat(genVars.GenNameUpper, "_EXECUTABLE");
-    std::string const val = this->Target->Target->GetSafeProperty(prop);
+    std::string const val = this->GenTarget->Target->GetSafeProperty(prop);
     if (!val.empty()) {
       // Evaluate generator expression
       {
-        cmListFileBacktrace lfbt =
-          this->Target->Target->GetMakefile()->GetBacktrace();
+        cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
         cmGeneratorExpression ge(lfbt);
         std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(val);
-        genVars.Executable =
-          cge->Evaluate(this->Target->GetLocalGenerator(), "");
+        genVars.Executable = cge->Evaluate(this->LocalGen, "");
       }
       if (genVars.Executable.empty() && !ignoreMissingTarget) {
         print_err(prop + " evaluates to an empty value");
@@ -1619,15 +1608,15 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
     std::string const targetName = cmStrCat(prefix, executable);
 
     // Find target
-    cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
-    cmGeneratorTarget* target = localGen->FindGeneratorTargetToUse(targetName);
-    if (target != nullptr) {
+    cmGeneratorTarget* genTarget =
+      this->LocalGen->FindGeneratorTargetToUse(targetName);
+    if (genTarget != nullptr) {
       genVars.ExecutableTargetName = targetName;
-      genVars.ExecutableTarget = target;
-      if (target->IsImported()) {
-        genVars.Executable = target->ImportedGetLocation("");
+      genVars.ExecutableTarget = genTarget;
+      if (genTarget->IsImported()) {
+        genVars.Executable = genTarget->ImportedGetLocation("");
       } else {
-        genVars.Executable = target->GetLocation("");
+        genVars.Executable = genTarget->GetLocation("");
       }
     } else {
       if (ignoreMissingTarget) {
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 84a27e4..d8d4dff 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -18,9 +18,12 @@
 #include <vector>
 
 class cmGeneratorTarget;
-class cmTarget;
+class cmGlobalGenerator;
+class cmLocalGenerator;
+class cmMakefile;
 class cmQtAutoGenGlobalInitializer;
 class cmSourceFile;
+class cmTarget;
 
 /// @brief Initializes the QtAutoGen generators
 class cmQtAutoGenInitializer : public cmQtAutoGen
@@ -112,10 +115,10 @@ public:
 public:
   /// @return The detected Qt version and the required Qt major version
   static std::pair<IntegerVersion, unsigned int> GetQtVersion(
-    cmGeneratorTarget const* target);
+    cmGeneratorTarget const* genTarget);
 
   cmQtAutoGenInitializer(cmQtAutoGenGlobalInitializer* globalInitializer,
-                         cmGeneratorTarget* target,
+                         cmGeneratorTarget* genTarget,
                          IntegerVersion const& qtVersion, bool mocEnabled,
                          bool uicEnabled, bool rccEnabled,
                          bool globalAutogenTarget, bool globalAutoRccTarget);
@@ -152,8 +155,11 @@ private:
                        bool ignoreMissingTarget) const;
 
 private:
-  cmQtAutoGenGlobalInitializer* GlobalInitializer;
-  cmGeneratorTarget* Target;
+  cmQtAutoGenGlobalInitializer* GlobalInitializer = nullptr;
+  cmGeneratorTarget* GenTarget = nullptr;
+  cmGlobalGenerator* GlobalGen = nullptr;
+  cmLocalGenerator* LocalGen = nullptr;
+  cmMakefile* Makefile = nullptr;
 
   // Configuration
   IntegerVersion QtVersion;

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-properties.7.rst                 |    1 +
 Help/manual/cmake-variables.7.rst                  |    1 +
 Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst              |   32 +
 Help/release/dev/automoc_path_prefix.rst           |   13 +
 Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst        |   11 +
 Modules/CMakeGenericSystem.cmake                   |    1 +
 Source/cmQtAutoGen.cxx                             |    9 +
 Source/cmQtAutoGen.h                               |    3 +
 Source/cmQtAutoGenInitializer.cxx                  |  366 ++++---
 Source/cmQtAutoGenInitializer.h                    |   18 +-
 Source/cmQtAutoGenerator.cxx                       |   31 +-
 Source/cmQtAutoGenerator.h                         |   24 +-
 Source/cmQtAutoMocUic.cxx                          | 1129 +++++++++++---------
 Source/cmQtAutoMocUic.h                            |  231 ++--
 Source/cmQtAutoRcc.cxx                             |  118 +-
 Source/cmTarget.cxx                                |    1 +
 Tests/QtAutogen/MocInclude/CMakeLists.txt          |  112 ++
 .../MocInclude/Common/DualSub/Second/Second.cpp    |   11 +
 .../MocInclude/Common/DualSub/Second/Second.hpp    |   14 +
 .../QtAutogen/MocInclude/Common/DualSubMocked.cpp  |    9 +
 .../QtAutogen/MocInclude/Common/DualSubMocked.hpp  |   15 +
 Tests/QtAutogen/MocInclude/Common/ExternDot.cpp    |   11 +
 .../MocInclude/{SObjA.hpp => Common/ExternDot.hpp} |   10 +-
 .../MocInclude/Common/ExternDotGenerated.cpp.in    |   11 +
 .../MocInclude/Common/ExternDotGenerated.hpp.in    |   15 +
 .../MocInclude/Common/InIncludes.in/SubOwnDot.cpp  |   43 +
 .../MocInclude/Common/InIncludes.in/SubOwnDot.hpp  |   17 +
 .../Common/InIncludes.in/SubOwnDot_p.hpp           |   18 +
 .../QtAutogen/MocInclude/Common/InIncludesMoc.cpp  |    4 +
 Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp  |   32 +
 Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp  |   20 +
 Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp |   39 +
 Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp |   17 +
 Tests/QtAutogen/MocInclude/Common/None.cpp         |   20 +
 Tests/QtAutogen/MocInclude/Common/None.hpp         |   19 +
 Tests/QtAutogen/MocInclude/Common/None_p.h         |   14 +
 .../MocInclude/Common/OtherUnderscore.cpp          |   44 +
 .../MocInclude/Common/OtherUnderscore.hpp          |   19 +
 .../MocInclude/Common/OtherUnderscoreExtra.cpp     |   20 +
 .../MocInclude/Common/OtherUnderscoreExtra.hpp     |   18 +
 .../MocInclude/Common/OtherUnderscoreExtra_p.hpp   |   14 +
 .../MocInclude/Common/OtherUnderscoreSub.cpp       |   45 +
 .../MocInclude/Common/OtherUnderscoreSub.hpp       |   19 +
 .../Common/OtherUnderscoreSubDir/SubExtra.cpp      |   20 +
 .../Common/OtherUnderscoreSubDir/SubExtra.hpp      |   18 +
 .../Common/OtherUnderscoreSubDir/SubExtra_p.hpp    |   14 +
 .../MocInclude/Common/OtherUnderscoreSub_p.hpp     |   14 +
 .../MocInclude/Common/OtherUnderscore_p.hpp        |   14 +
 Tests/QtAutogen/MocInclude/Common/OwnDot.cpp       |   39 +
 Tests/QtAutogen/MocInclude/Common/OwnDot.hpp       |   19 +
 .../MocInclude/Common/OwnDotUnderscore.cpp         |   40 +
 .../MocInclude/Common/OwnDotUnderscore.hpp         |   19 +
 .../MocInclude/Common/OwnDotUnderscore_p.h         |   14 +
 Tests/QtAutogen/MocInclude/Common/OwnDot_p.h       |   14 +
 .../QtAutogen/MocInclude/Common/OwnUnderscore.cpp  |   22 +
 .../QtAutogen/MocInclude/Common/OwnUnderscore.hpp  |   19 +
 .../QtAutogen/MocInclude/Common/OwnUnderscore_p.h  |   14 +
 Tests/QtAutogen/MocInclude/Common/common.cpp.in    |   32 +
 .../MocInclude/Common/moc_MixedCustom.cpp.in       |    5 +
 Tests/QtAutogen/MocInclude/EObjA.cpp               |   44 -
 Tests/QtAutogen/MocInclude/EObjA.hpp               |   19 -
 Tests/QtAutogen/MocInclude/EObjAExtra.cpp          |   20 -
 Tests/QtAutogen/MocInclude/EObjAExtra.hpp          |   18 -
 Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp        |   14 -
 Tests/QtAutogen/MocInclude/EObjA_p.hpp             |   14 -
 Tests/QtAutogen/MocInclude/EObjB.cpp               |   45 -
 Tests/QtAutogen/MocInclude/EObjB.hpp               |   19 -
 Tests/QtAutogen/MocInclude/EObjB_p.hpp             |   14 -
 Tests/QtAutogen/MocInclude/LObjA.cpp               |   39 -
 Tests/QtAutogen/MocInclude/LObjA.hpp               |   19 -
 Tests/QtAutogen/MocInclude/LObjA_p.h               |   14 -
 Tests/QtAutogen/MocInclude/LObjB.cpp               |   40 -
 Tests/QtAutogen/MocInclude/LObjB.hpp               |   19 -
 Tests/QtAutogen/MocInclude/LObjB_p.h               |   14 -
 Tests/QtAutogen/MocInclude/ObjA.cpp                |   20 -
 Tests/QtAutogen/MocInclude/ObjA.hpp                |   19 -
 Tests/QtAutogen/MocInclude/ObjA_p.h                |   14 -
 Tests/QtAutogen/MocInclude/ObjB.cpp                |   22 -
 Tests/QtAutogen/MocInclude/ObjB.hpp                |   19 -
 Tests/QtAutogen/MocInclude/ObjB_p.h                |   14 -
 Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt  |   17 +
 .../Relaxed}/RObjA.cpp                             |    0
 .../Relaxed}/RObjA.hpp                             |    0
 .../Relaxed}/RObjB.cpp                             |    0
 .../Relaxed}/RObjB.hpp                             |    0
 .../Relaxed}/RObjBExtra.hpp                        |    0
 .../Relaxed}/RObjC.cpp                             |    0
 .../Relaxed}/RObjC.hpp                             |    0
 Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp     |   21 +
 Tests/QtAutogen/MocInclude/SObjA.cpp               |   11 -
 Tests/QtAutogen/MocInclude/SObjB.cpp.in            |   11 -
 Tests/QtAutogen/MocInclude/SObjB.hpp.in            |   15 -
 Tests/QtAutogen/MocInclude/SObjC.cpp               |   35 -
 Tests/QtAutogen/MocInclude/SObjC.hpp               |   15 -
 Tests/QtAutogen/MocInclude/SObjCExtra.cpp          |   31 -
 Tests/QtAutogen/MocInclude/SObjCExtra.hpp          |   15 -
 Tests/QtAutogen/MocInclude/SObjCExtra.moc.in       |    4 -
 Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt   |   14 +
 Tests/QtAutogen/MocInclude/Strict/strict.cpp       |    7 +
 Tests/QtAutogen/MocInclude/main.cpp                |    9 +
 Tests/QtAutogen/MocInclude/shared.cmake            |   71 --
 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp |   20 -
 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp |   18 -
 .../QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp |   14 -
 Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp      |   41 -
 Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp      |   17 -
 Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp    |   17 -
 Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt   |   20 -
 Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp        |   12 -
 Tests/QtAutogen/MocIncludeRelaxed/main.cpp         |   26 -
 Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt    |   10 -
 Tests/QtAutogen/MocIncludeStrict/main.cpp          |   26 -
 Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt   |   80 ++
 Tests/QtAutogen/Tests.cmake                        |    4 +-
 114 files changed, 2198 insertions(+), 1779 deletions(-)
 create mode 100644 Help/prop_tgt/AUTOMOC_PATH_PREFIX.rst
 create mode 100644 Help/release/dev/automoc_path_prefix.rst
 create mode 100644 Help/variable/CMAKE_AUTOMOC_PATH_PREFIX.rst
 create mode 100644 Tests/QtAutogen/MocInclude/CMakeLists.txt
 create mode 100644 Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/ExternDot.cpp
 rename Tests/QtAutogen/MocInclude/{SObjA.hpp => Common/ExternDot.hpp} (50%)
 create mode 100644 Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in
 create mode 100644 Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in
 create mode 100644 Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/None.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/None.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/None_p.h
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnDot.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnDot.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnDot_p.h
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp
 create mode 100644 Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h
 create mode 100644 Tests/QtAutogen/MocInclude/Common/common.cpp.in
 create mode 100644 Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjA.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjA.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjA_p.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjB.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjB.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/EObjB_p.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/LObjA.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/LObjA.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/LObjA_p.h
 delete mode 100644 Tests/QtAutogen/MocInclude/LObjB.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/LObjB.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/LObjB_p.h
 delete mode 100644 Tests/QtAutogen/MocInclude/ObjA.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/ObjA.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/ObjA_p.h
 delete mode 100644 Tests/QtAutogen/MocInclude/ObjB.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/ObjB.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/ObjB_p.h
 create mode 100644 Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjA.cpp (100%)
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjA.hpp (100%)
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjB.cpp (100%)
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjB.hpp (100%)
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjBExtra.hpp (100%)
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjC.cpp (100%)
 rename Tests/QtAutogen/{MocIncludeRelaxed => MocInclude/Relaxed}/RObjC.hpp (100%)
 create mode 100644 Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjA.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjB.cpp.in
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjB.hpp.in
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjC.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjC.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.moc.in
 create mode 100644 Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt
 create mode 100644 Tests/QtAutogen/MocInclude/Strict/strict.cpp
 create mode 100644 Tests/QtAutogen/MocInclude/main.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/shared.cmake
 delete mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp
 delete mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp
 delete mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp
 delete mode 100644 Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
 delete mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp
 delete mode 100644 Tests/QtAutogen/MocIncludeRelaxed/main.cpp
 delete mode 100644 Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt
 delete mode 100644 Tests/QtAutogen/MocIncludeStrict/main.cpp
 create mode 100644 Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list