[Cmake-commits] CMake branch, next, updated. v3.7.1-1623-g78c5389

Brad King brad.king at kitware.com
Wed Dec 7 08:25:15 EST 2016


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, next has been updated
       via  78c53899db3fdf4d680ba78f50f37312cc2383eb (commit)
       via  c8a4147a34d38ec6a96c51e750f70f76a90ff1dc (commit)
       via  e1f571a98371ec99467502234671fb52f8f6cce9 (commit)
       via  e324d70409b8f56c0d870916f81d8b848233c4e1 (commit)
       via  c2211703d35de8fc24e818680c033503b96167ff (commit)
       via  2da0875f3a8cc91a8355298cc8da0a34f98acf09 (commit)
       via  5961db41436081f0ff936ba56a7053f51551afc1 (commit)
       via  6d0a8af3687c66f95d7f787402f7aa82c8fae73a (commit)
       via  6731025211bb300f762ac4d4984de124dc38c95a (commit)
       via  43d77e1dadab06f9b49ebb6cbfdaffcc4b708f1a (commit)
       via  98665c35199fffb66ff92f5f15da0e1580625cc0 (commit)
       via  df74f3ff834cacdd46aff7366a479d8317315a7c (commit)
       via  bafbeaf19076f9ae94be2b8cdb845617674aaf99 (commit)
       via  8f437f3c35ae13c147e0d022a84774750d4a0a7a (commit)
       via  360c3427117312548358fddce906a346f17b8f5f (commit)
       via  b5409d04f1c1309deb7e45163a106c8cb4daf38c (commit)
       via  d9996aab74836bb830e106bea0b0064a4c74cb1c (commit)
       via  b770b85d6c05fd36462172e33c8b700b22b801e9 (commit)
       via  5c3dc7460ea6644bd658131ec474e6ddce825b1a (commit)
       via  8c9358386b0b2826ffc3da4385474a4227477eef (commit)
       via  8f47a5f16aa685e15e6b49c0b90a58b18ea38d0a (commit)
       via  057ac11bfbc5501c8037b173a73a55466163774d (commit)
       via  d3afe4070b9c5ba08a11ce3b4b30d2c1ad4c591d (commit)
       via  6f53b1ab642ca1e5977121ec60779f248cf8ee88 (commit)
       via  39e07d7a175d5da0c1a2ebc905689705571d2084 (commit)
       via  8c6f990fb600d042ebb7a21996280ef31798bc79 (commit)
       via  49f8687e1601bacd3386d8393dc831124691715e (commit)
       via  7731121d66dc2212c67eb9d49840ac846bd00ce7 (commit)
       via  00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3 (commit)
       via  708e44af5d445d25cc39e83da800ccc57f90a79a (commit)
       via  1c97d1df20bbf771568321020e84718b82788272 (commit)
      from  f0f7cd4861749984392a3247faba705303755f01 (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=78c53899db3fdf4d680ba78f50f37312cc2383eb
commit 78c53899db3fdf4d680ba78f50f37312cc2383eb
Merge: f0f7cd4 c8a4147
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 7 08:25:13 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Dec 7 08:25:13 2016 -0500

    Merge topic 'QtAutogen_Contain' into next
    
    c8a4147a QtAutogen: Release notes for the Contain branch
    e1f571a9 QtAutogen: CMake-Qt documentation update
    e324d704 QtAutogen: AUTOMOC documentation update
    c2211703 QtAutogen: Tests: Don't use std::auto_ptr
    2da0875f QtAutogen: Tests: Update ui_ include lookup directory
    5961db41 QtAutogen: Tests: Increase minimum required CMake version
    6d0a8af3 QtAutogen: Tests: Don't use std::auto_ptr
    67310252 QtAutogen: Tests: Don't include CMAKE_CURRENT_BINARY_DIR
    43d77e1d QtAutogen: Don't use std::i/ofstream::is_open()
    98665c35 QtAutogen: Rename and sort variables
    df74f3ff QtAutogen: Generate rcc output file names in one place only
    bafbeaf1 QtAutogen: Add rcc output files to autogen target byproducts
    8f437f3c QtAutogen: Add moc compilation file to autogen target byproducts
    360c3427 QtAutogen: Reconfigure when .qrc file changes
    b5409d04 QtAutogen: Rename autogen target to *_autogen from *_automoc
    d9996aab QtAutogen: Inline single use variable definitions
    ...


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8a4147a34d38ec6a96c51e750f70f76a90ff1dc
commit c8a4147a34d38ec6a96c51e750f70f76a90ff1dc
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 22:53:00 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:07 2016 -0500

    QtAutogen: Release notes for the Contain branch

diff --git a/Help/release/dev/QtAutogen_Contain.rst b/Help/release/dev/QtAutogen_Contain.rst
new file mode 100644
index 0000000..182233b
--- /dev/null
+++ b/Help/release/dev/QtAutogen_Contain.rst
@@ -0,0 +1,10 @@
+QtAutogen_Contain
+-----------------
+
+* When using AUTOMOC or AUTOUIC, generated
+  ``moc_*``, ``*.moc`` and ``ui_*`` are placed in the
+  ``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which
+  is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+  It is therefore not necessary anymore to have
+  :variable:`CMAKE_CURRENT_BINARY_DIR` in the target's
+  :prop_tgt:`INCLUDE_DIRECTORIES`.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1f571a98371ec99467502234671fb52f8f6cce9
commit e1f571a98371ec99467502234671fb52f8f6cce9
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon Dec 5 18:25:30 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:07 2016 -0500

    QtAutogen: CMake-Qt documentation update

diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst
index 7827065..80b0f49 100644
--- a/Help/manual/cmake-qt.7.rst
+++ b/Help/manual/cmake-qt.7.rst
@@ -22,12 +22,11 @@ Qt 4 and Qt 5 may be used together in the same
 
 .. code-block:: cmake
 
-  cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+  cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
 
   project(Qt4And5)
 
   set(CMAKE_AUTOMOC ON)
-  set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
   find_package(Qt5 COMPONENTS Widgets DBus REQUIRED)
   add_executable(publisher publisher.cpp)
@@ -73,9 +72,12 @@ The ``moc`` command line will consume the :prop_tgt:`COMPILE_DEFINITIONS` and
 :prop_tgt:`INCLUDE_DIRECTORIES` target properties from the target it is being
 invoked for, and for the appropriate build configuration.
 
-Generated ``moc_*.cpp`` and ``*.moc`` files are placed in the build directory
-so it is convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR`
-variable.  The :prop_tgt:`AUTOMOC` target property may be pre-set for all
+The generated ``moc_*.cpp`` and ``*.moc`` files are placed in the
+``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which is
+automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+(This differs from CMake 3.7 and below; see their documentation for details.)
+
+The :prop_tgt:`AUTOMOC` target property may be pre-set for all
 following targets by setting the :variable:`CMAKE_AUTOMOC` variable.  The
 :prop_tgt:`AUTOMOC_MOC_OPTIONS` target property may be populated to set
 options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS`
@@ -94,10 +96,13 @@ If a preprocessor ``#include`` directive is found which matches
 ``ui_<basename>.h``, and a ``<basename>.ui`` file exists, then ``uic`` will
 be executed to generate the appropriate file.
 
-Generated ``ui_*.h`` files are placed in the build directory so it is
-convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR` variable.  The
-:prop_tgt:`AUTOUIC` target property may be pre-set for all following targets
-by setting the :variable:`CMAKE_AUTOUIC` variable.  The
+The generated generated ``ui_*.h`` files are placed in the
+``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which is
+automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+(This differs from CMake 3.7 and below; see their documentation for details.)
+
+The :prop_tgt:`AUTOUIC` target property may be pre-set for all following
+targets by setting the :variable:`CMAKE_AUTOUIC` variable.  The
 :prop_tgt:`AUTOUIC_OPTIONS` target property may be populated to set options
 to pass to ``uic``.  The :variable:`CMAKE_AUTOUIC_OPTIONS` variable may be
 populated to pre-set the options for all following targets.  The

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e324d70409b8f56c0d870916f81d8b848233c4e1
commit e324d70409b8f56c0d870916f81d8b848233c4e1
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 22:22:50 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:06 2016 -0500

    QtAutogen: AUTOMOC documentation update

diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index eea57e3..30a39b1 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -15,11 +15,12 @@ source files at build time and invoke moc accordingly.
   the ``Q_OBJECT`` class declaration is expected in the header, and
   ``moc`` is run on the header file.  A ``moc_foo.cpp`` file will be
   generated from the source's header into the
-  :variable:`CMAKE_CURRENT_BINARY_DIR` directory.  This allows the
-  compiler to find the included ``moc_foo.cpp`` file regardless of the
-  location the original source.  However, if multiple source files
-  in different directories do this then their generated moc files would
-  collide.  In this case a diagnostic will be issued.
+  ``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include``
+  directory which is automatically added to the target's
+  :prop_tgt:`INCLUDE_DIRECTORIES`.  This allows the compiler to find the
+  included ``moc_foo.cpp`` file regardless of the location the original source.
+  However, if multiple source files in different directories do this then their
+  generated moc files would collide.  In this case a diagnostic will be issued.
 
 * If an ``#include`` statement like ``#include "foo.moc"`` is found,
   then a ``Q_OBJECT`` is expected in the current source file and ``moc``

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2211703d35de8fc24e818680c033503b96167ff
commit c2211703d35de8fc24e818680c033503b96167ff
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Dec 6 16:46:16 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:06 2016 -0500

    QtAutogen: Tests: Don't use std::auto_ptr

diff --git a/Tests/QtAutoUicInterface/libwidget.cpp b/Tests/QtAutoUicInterface/libwidget.cpp
index b25f3d7..008c22a 100644
--- a/Tests/QtAutoUicInterface/libwidget.cpp
+++ b/Tests/QtAutoUicInterface/libwidget.cpp
@@ -7,3 +7,8 @@ LibWidget::LibWidget(QWidget* parent)
 {
   ui->setupUi(this);
 }
+
+LibWidget::~LibWidget()
+{
+  delete ui;
+}
diff --git a/Tests/QtAutoUicInterface/libwidget.h b/Tests/QtAutoUicInterface/libwidget.h
index a4400d2..b6f3e82 100644
--- a/Tests/QtAutoUicInterface/libwidget.h
+++ b/Tests/QtAutoUicInterface/libwidget.h
@@ -16,9 +16,10 @@ class LibWidget : public QWidget
   Q_OBJECT
 public:
   explicit LibWidget(QWidget* parent = 0);
+  ~LibWidget();
 
 private:
-  const std::auto_ptr<Ui::LibWidget> ui;
+  Ui::LibWidget* ui;
 };
 
 #endif
diff --git a/Tests/QtAutoUicInterface/mywidget.cpp b/Tests/QtAutoUicInterface/mywidget.cpp
index 885165b..7cf1a13 100644
--- a/Tests/QtAutoUicInterface/mywidget.cpp
+++ b/Tests/QtAutoUicInterface/mywidget.cpp
@@ -7,3 +7,8 @@ MyWidget::MyWidget(QWidget* parent)
 {
   ui->setupUi(this);
 }
+
+MyWidget::~MyWidget()
+{
+  delete ui;
+}
diff --git a/Tests/QtAutoUicInterface/mywidget.h b/Tests/QtAutoUicInterface/mywidget.h
index fc49e80..c23e55d 100644
--- a/Tests/QtAutoUicInterface/mywidget.h
+++ b/Tests/QtAutoUicInterface/mywidget.h
@@ -16,9 +16,10 @@ class MyWidget : public QWidget
   Q_OBJECT
 public:
   explicit MyWidget(QWidget* parent = 0);
+  ~MyWidget();
 
 private:
-  const std::auto_ptr<Ui::MyWidget> ui;
+  Ui::MyWidget* ui;
 };
 
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2da0875f3a8cc91a8355298cc8da0a34f98acf09
commit 2da0875f3a8cc91a8355298cc8da0a34f98acf09
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Dec 6 16:42:24 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:06 2016 -0500

    QtAutogen: Tests: Update ui_ include lookup directory

diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt
index 555f016..70175fb 100644
--- a/Tests/QtAutoUicInterface/CMakeLists.txt
+++ b/Tests/QtAutoUicInterface/CMakeLists.txt
@@ -1,5 +1,5 @@
 
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.7)
 
 project(QtAutoUicInterface)
 
@@ -21,7 +21,6 @@ else()
 endif()
 
 set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTOUIC ON)
 
@@ -65,6 +64,6 @@ target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET})
 add_executable(QtAutoUicInterface main.cpp)
 target_compile_definitions(QtAutoUicInterface
   PRIVATE
-    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_libwidget.h"
-    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_mywidget.h"
+    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/include/ui_libwidget.h"
+    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/include/ui_mywidget.h"
 )

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5961db41436081f0ff936ba56a7053f51551afc1
commit 5961db41436081f0ff936ba56a7053f51551afc1
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon Dec 5 18:44:13 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:05 2016 -0500

    QtAutogen: Tests: Increase minimum required CMake version

diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index fdc766b..6d4e2c4 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.7)
 
 project(QtAutogen)
 
diff --git a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
index 17bc332..92a682b 100644
--- a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
+++ b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.7)
 project(automoc_rerun CXX)
 
 if (QT_TEST_VERSION STREQUAL 4)
diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
index fbe71ad..7b51e11 100644
--- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
+++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.7)
 project(autorcc_depends)
 
 set(CMAKE_AUTORCC ON)
diff --git a/Tests/QtAutogen/complex/CMakeLists.txt b/Tests/QtAutogen/complex/CMakeLists.txt
index 30d2708..d48f6cc 100644
--- a/Tests/QtAutogen/complex/CMakeLists.txt
+++ b/Tests/QtAutogen/complex/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.7)
 
 # -- Test: AUTOMOC AUTORCC AUTOUIC
 add_definitions(-DFOO -DSomeDefine="Barx")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d0a8af3687c66f95d7f787402f7aa82c8fae73a
commit 6d0a8af3687c66f95d7f787402f7aa82c8fae73a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:51:15 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:05 2016 -0500

    QtAutogen: Tests: Don't use std::auto_ptr

diff --git a/Tests/QtAutogen/uicOnlySource/uiconly.cpp b/Tests/QtAutogen/uicOnlySource/uiconly.cpp
index ac22789..7b91b25 100644
--- a/Tests/QtAutogen/uicOnlySource/uiconly.cpp
+++ b/Tests/QtAutogen/uicOnlySource/uiconly.cpp
@@ -7,6 +7,11 @@ UicOnly::UicOnly(QWidget* parent)
 {
 }
 
+UicOnly::~UicOnly()
+{
+  delete ui;
+}
+
 int main()
 {
   return 0;
diff --git a/Tests/QtAutogen/uicOnlySource/uiconly.h b/Tests/QtAutogen/uicOnlySource/uiconly.h
index 9b0b1b4..8f4eebe 100644
--- a/Tests/QtAutogen/uicOnlySource/uiconly.h
+++ b/Tests/QtAutogen/uicOnlySource/uiconly.h
@@ -3,7 +3,6 @@
 #define UIC_ONLY_H
 
 #include <QWidget>
-#include <memory>
 
 #include "ui_uiconly.h"
 
@@ -12,9 +11,10 @@ class UicOnly : public QWidget
   Q_OBJECT
 public:
   explicit UicOnly(QWidget* parent = 0);
+  ~UicOnly();
 
 private:
-  const std::auto_ptr<Ui::UicOnly> ui;
+  Ui::UicOnly* ui;
 };
 
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6731025211bb300f762ac4d4984de124dc38c95a
commit 6731025211bb300f762ac4d4984de124dc38c95a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:34:37 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:05 2016 -0500

    QtAutogen: Tests: Don't include CMAKE_CURRENT_BINARY_DIR

diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index c4d0567..fdc766b 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -45,7 +45,6 @@ else()
 endif()
 
 get_property(QT_COMPILE_FEATURES TARGET ${QT_QTCORE_TARGET} PROPERTY INTERFACE_COMPILE_FEATURES)
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 # -- Test: AUTORCC
 # RCC only
diff --git a/Tests/QtAutogen/complex/Bdir/CMakeLists.txt b/Tests/QtAutogen/complex/Bdir/CMakeLists.txt
index d9d4aa7..d338763 100644
--- a/Tests/QtAutogen/complex/Bdir/CMakeLists.txt
+++ b/Tests/QtAutogen/complex/Bdir/CMakeLists.txt
@@ -6,5 +6,4 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
 add_library(libB SHARED libB.cpp)
 generate_export_header(libB)
 
-# set_property(TARGET libB APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
 target_link_libraries(libB LINK_PUBLIC libA)
diff --git a/Tests/QtAutogen/complex/CMakeLists.txt b/Tests/QtAutogen/complex/CMakeLists.txt
index 0d44f50..30d2708 100644
--- a/Tests/QtAutogen/complex/CMakeLists.txt
+++ b/Tests/QtAutogen/complex/CMakeLists.txt
@@ -1,7 +1,6 @@
 cmake_minimum_required(VERSION 3.1)
 
 # -- Test: AUTOMOC AUTORCC AUTOUIC
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
 add_definitions(-DFOO -DSomeDefine="Barx")
 
 # enable relaxed mode so automoc can handle all the special cases:
@@ -77,5 +76,7 @@ add_library(libC SHARED libC.cpp)
 set_target_properties(libC PROPERTIES AUTOMOC TRUE)
 generate_export_header(libC)
 target_link_libraries(libC LINK_PUBLIC libB)
+target_include_directories(libC PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+set_property(TARGET libC APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} )
 
 target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC)
diff --git a/Tests/QtAutogen/defines_test/CMakeLists.txt b/Tests/QtAutogen/defines_test/CMakeLists.txt
index ad4e684..9ee9a22 100644
--- a/Tests/QtAutogen/defines_test/CMakeLists.txt
+++ b/Tests/QtAutogen/defines_test/CMakeLists.txt
@@ -1,6 +1,4 @@
 
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
 add_executable(defines_test defines_test.cpp)
 set_target_properties(defines_test PROPERTIES AUTOMOC TRUE)
 target_link_libraries(defines_test Qt4::QtGui)
diff --git a/Tests/QtAutogen/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt
index ed045fb..9e47a3e 100644
--- a/Tests/QtAutogen/sameName/CMakeLists.txt
+++ b/Tests/QtAutogen/sameName/CMakeLists.txt
@@ -16,6 +16,5 @@ add_executable(sameName
   data.qrc
   main.cpp
 )
-target_include_directories(sameName PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
 target_link_libraries(sameName ${QT_LIBRARIES})
-set_target_properties( sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE )
+set_target_properties(sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43d77e1dadab06f9b49ebb6cbfdaffcc4b708f1a
commit 43d77e1dadab06f9b49ebb6cbfdaffcc4b708f1a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Dec 6 17:33:10 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:04 2016 -0500

    QtAutogen: Don't use std::i/ofstream::is_open()

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 506c820..eb513e5 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -390,13 +390,14 @@ bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
   {
     cmsys::ofstream outfile;
     outfile.open(filename.c_str(), std::ios::trunc);
-    success = outfile.is_open();
-    if (success) {
+    if (outfile) {
       outfile << "set(AM_OLD_COMPILE_SETTINGS "
               << cmOutputConverter::EscapeForCMake(
                    this->CurrentCompileSettingsStr)
               << ")\n";
       success = outfile.good();
+    } else {
+      success = false;
     }
   }
 
@@ -1116,7 +1117,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
   if (success) {
     cmsys::ofstream outfile;
     outfile.open(this->OutMocCppFilenameAbs.c_str(), std::ios::trunc);
-    if (!outfile.is_open()) {
+    if (!outfile) {
       success = false;
       std::ostringstream err;
       err << "AUTOGEN: error opening " << this->OutMocCppFilenameAbs << "\n";

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98665c35199fffb66ff92f5f15da0e1580625cc0
commit 98665c35199fffb66ff92f5f15da0e1580625cc0
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sun Dec 4 11:38:31 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:04 2016 -0500

    QtAutogen: Rename and sort variables

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index ee5eb11..506c820 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -200,26 +200,35 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
     return false;
   }
 
+  // - Target names
+  this->OriginTargetName =
+    makefile->GetSafeDefinition("AM_ORIGIN_TARGET_NAME");
+  this->AutogenTargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
+
+  // - Directories
+  this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
+  this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
+  this->CurrentSourceDir =
+    makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR");
+  this->CurrentBinaryDir =
+    makefile->GetSafeDefinition("AM_CMAKE_CURRENT_BINARY_DIR");
+
+  // - Qt environment
   this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
   if (this->QtMajorVersion == "") {
     this->QtMajorVersion =
       makefile->GetSafeDefinition("AM_Qt5Core_VERSION_MAJOR");
   }
-  this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
-  {
-    std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES");
-    cmSystemTools::ExpandListArgument(rccSources, this->RccSources);
-  }
-  this->SkipMoc = makefile->GetSafeDefinition("AM_SKIP_MOC");
-  this->SkipUic = makefile->GetSafeDefinition("AM_SKIP_UIC");
-  this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
-  this->IncludeProjectDirsBefore =
-    makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
-  this->Srcdir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR");
-  this->Builddir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_BINARY_DIR");
   this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE");
   this->UicExecutable = makefile->GetSafeDefinition("AM_QT_UIC_EXECUTABLE");
   this->RccExecutable = makefile->GetSafeDefinition("AM_QT_RCC_EXECUTABLE");
+
+  // - File Lists
+  this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
+  this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
+
+  // - Moc
+  this->SkipMoc = makefile->GetSafeDefinition("AM_SKIP_MOC");
   {
     std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS";
     std::string compileDefsProp = compileDefsPropOrig;
@@ -244,12 +253,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
       includes ? includes : makefile->GetSafeDefinition(includesPropOrig);
   }
   this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
-  this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
-  this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
-  this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
-  this->OriginTargetName =
-    makefile->GetSafeDefinition("AM_ORIGIN_TARGET_NAME");
 
+  // - Uic
+  this->SkipUic = makefile->GetSafeDefinition("AM_SKIP_UIC");
   {
     const char* uicOptionsFiles =
       makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
@@ -280,6 +286,12 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
       this->UicOptions[*fileIt] = *optionIt;
     }
   }
+
+  // - Rcc
+  {
+    std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES");
+    cmSystemTools::ExpandListArgument(rccSources, this->RccSources);
+  }
   {
     const char* rccOptionsFiles =
       makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES");
@@ -325,8 +337,13 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
       this->RccInputs[*fileIt] = rccInputFiles;
     }
   }
+
+  // - Settings
   this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile);
 
+  // - Flags
+  this->IncludeProjectDirsBefore =
+    makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
   this->MocRelaxedMode = makefile->IsOn("AM_MOC_RELAXED_MODE");
 
   return true;
@@ -388,16 +405,17 @@ bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
 
 void cmQtAutoGenerators::Init()
 {
-  this->TargetBuildSubDir = this->TargetName;
-  this->TargetBuildSubDir += "/";
+  this->AutogenBuildSubDir = this->AutogenTargetName;
+  this->AutogenBuildSubDir += "/";
 
-  this->OutMocCppFilenameRel = this->TargetBuildSubDir;
+  this->OutMocCppFilenameRel = this->AutogenBuildSubDir;
   this->OutMocCppFilenameRel += "moc_compilation.cpp";
 
-  this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
+  this->OutMocCppFilenameAbs =
+    this->CurrentBinaryDir + this->OutMocCppFilenameRel;
 
   // Init file path checksum generator
-  fpathCheckSum.setupParentDirs(this->Srcdir, this->Builddir,
+  fpathCheckSum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir,
                                 this->ProjectSourceDir,
                                 this->ProjectBinaryDir);
 
@@ -1125,8 +1143,8 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
                                      const std::string& subDirPrefix)
 {
   const std::string mocFileRel =
-    this->TargetBuildSubDir + subDirPrefix + mocFileName;
-  const std::string mocFileAbs = this->Builddir + mocFileRel;
+    this->AutogenBuildSubDir + subDirPrefix + mocFileName;
+  const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel;
   int sourceNewerThanMoc = 0;
   bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs,
                                                      &sourceNewerThanMoc);
@@ -1246,8 +1264,8 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
                                     const std::string& uiOutputFile)
 {
   const std::string uicFileRel =
-    this->TargetBuildSubDir + "include/" + uiOutputFile;
-  const std::string uicFileAbs = this->Builddir + uicFileRel;
+    this->AutogenBuildSubDir + "include/" + uiOutputFile;
+  const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel;
 
   int sourceNewerThanUi = 0;
   bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uicFileAbs,
@@ -1328,7 +1346,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
        si != this->RccSources.end(); ++si) {
     const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
     if (ext == ".qrc") {
-      qrcGenMap[*si] = this->TargetBuildSubDir + fpathCheckSum.getPart(*si) +
+      qrcGenMap[*si] = this->AutogenBuildSubDir + fpathCheckSum.getPart(*si) +
         "/qrc_" + cmsys::SystemTools::GetFilenameWithoutLastExtension(*si) +
         ".cpp";
     }
@@ -1379,7 +1397,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
   // file names but not for symbol names.
   std::replace(symbolName.begin(), symbolName.end(), '-', '_');
 
-  const std::string qrcBuildFile = this->Builddir + qrcOutputFile;
+  const std::string qrcBuildFile = this->CurrentBinaryDir + qrcOutputFile;
 
   int sourceNewerThanQrc = 0;
   bool generateQrc = !cmsys::SystemTools::FileTimeCompare(
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 5fbaf87..c241579 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -102,41 +102,47 @@ private:
   bool InputFilesNewerThanQrc(const std::string& qrcFile,
                               const std::string& rccOutput);
 
+  // - Target names
+  std::string OriginTargetName;
+  std::string AutogenTargetName;
+  // - Directories
+  std::string ProjectSourceDir;
+  std::string ProjectBinaryDir;
+  std::string CurrentSourceDir;
+  std::string CurrentBinaryDir;
+  std::string AutogenBuildSubDir;
+  // - Qt environment
   std::string QtMajorVersion;
-  std::string Sources;
-  std::vector<std::string> RccSources;
-  std::string SkipMoc;
-  std::string SkipUic;
-  std::string Headers;
-  std::string Srcdir;
-  std::string Builddir;
   std::string MocExecutable;
   std::string UicExecutable;
   std::string RccExecutable;
+  // - File lists
+  std::string Sources;
+  std::string Headers;
+  // - Moc
+  std::string SkipMoc;
   std::string MocCompileDefinitionsStr;
   std::string MocIncludesStr;
   std::string MocOptionsStr;
-  std::string ProjectBinaryDir;
-  std::string ProjectSourceDir;
-  std::string TargetName;
-  std::string OriginTargetName;
-
-  std::string CurrentCompileSettingsStr;
-  std::string OldCompileSettingsStr;
-
-  std::string TargetBuildSubDir;
   std::string OutMocCppFilenameRel;
   std::string OutMocCppFilenameAbs;
   std::list<std::string> MocIncludes;
   std::list<std::string> MocDefinitions;
   std::vector<std::string> MocOptions;
+  // - Uic
+  std::string SkipUic;
   std::vector<std::string> UicTargetOptions;
   std::map<std::string, std::string> UicOptions;
+  // - Rcc
+  std::vector<std::string> RccSources;
   std::map<std::string, std::string> RccOptions;
   std::map<std::string, std::vector<std::string> > RccInputs;
-
+  // - Settings
+  std::string CurrentCompileSettingsStr;
+  std::string OldCompileSettingsStr;
+  // - Utility
   cmFilePathChecksum fpathCheckSum;
-
+  // - Flags
   bool IncludeProjectDirsBefore;
   bool Verbose;
   bool ColorOutput;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df74f3ff834cacdd46aff7366a479d8317315a7c
commit df74f3ff834cacdd46aff7366a479d8317315a7c
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 17:39:59 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:04 2016 -0500

    QtAutogen: Generate rcc output file names in one place only

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 8ddf5b6..f0847b1 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -109,8 +109,6 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
   std::vector<cmSourceFile*> srcFiles;
   target->GetConfigCommonSourceFiles(srcFiles);
 
-  std::vector<std::string> rccOutput;
-
   cmFilePathChecksum fpathCheckSum(makefile);
   for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
        fileIt != srcFiles.end(); ++fileIt) {
@@ -123,23 +121,6 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
       skipUic.push_back(absFile);
     }
 
-    if (target->GetPropertyAsBool("AUTORCC")) {
-      if (ext == "qrc" &&
-          !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
-
-        // Run cmake again when .qrc file changes
-        makefile->AddCMakeDependFile(absFile);
-
-        std::string rccOutputFile = GetAutogenTargetBuildDir(target);
-        rccOutputFile += fpathCheckSum.getPart(absFile);
-        rccOutputFile += "/qrc_";
-        rccOutputFile +=
-          cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
-        rccOutputFile += ".cpp";
-        rccOutput.push_back(rccOutputFile);
-      }
-    }
-
     if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
       if (cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"))) {
         skipMoc.push_back(absFile);
@@ -154,18 +135,6 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
       }
     }
   }
-
-  // Add rcc output files as sources
-  for (std::vector<std::string>::const_iterator fileIt = rccOutput.begin();
-       fileIt != rccOutput.end(); ++fileIt) {
-    const std::string& rccOutputFile = *fileIt;
-    // Add source
-    makefile->GetOrCreateSource(rccOutputFile, true);
-    const_cast<cmGeneratorTarget*>(target)->AddSource(rccOutputFile);
-    // Create output directory
-    cmSystemTools::MakeDirectory(
-      cmsys::SystemTools::GetFilenamePath(rccOutputFile));
-  }
 }
 
 static void GetCompileDefinitionsAndDirectories(
@@ -783,12 +752,19 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
           const std::string absFile =
             cmsys::SystemTools::GetRealPath(sf->GetFullPath());
 
+          // Run cmake again when .qrc file changes
+          makefile->AddCMakeDependFile(absFile);
+
           std::string rccOutputFile = autogenBuildDir;
           rccOutputFile += fpathCheckSum.getPart(absFile);
           rccOutputFile += "/qrc_";
           rccOutputFile +=
             cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
           rccOutputFile += ".cpp";
+
+          // Add rcc output file to origin target sources
+          makefile->GetOrCreateSource(rccOutputFile, true);
+          target->AddSource(rccOutputFile);
           // Register rcc output file as generated
           autogenOutputFiles.push_back(rccOutputFile);
         }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bafbeaf19076f9ae94be2b8cdb845617674aaf99
commit bafbeaf19076f9ae94be2b8cdb845617674aaf99
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 17:21:40 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:03 2016 -0500

    QtAutogen: Add rcc output files to autogen target byproducts

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 3a46ab0..8ddf5b6 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -128,7 +128,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
           !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
 
         // Run cmake again when .qrc file changes
-        makefile->AddCMakeDependFile ( absFile );
+        makefile->AddCMakeDependFile(absFile);
 
         std::string rccOutputFile = GetAutogenTargetBuildDir(target);
         rccOutputFile += fpathCheckSum.getPart(absFile);
@@ -697,7 +697,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
   if (target->GetPropertyAsBool("AUTOMOC")) {
     // Register moc compilation file as generated
-    autogenOutputFiles.push_back ( autogenBuildDir + "moc_compilation.cpp" );
+    autogenOutputFiles.push_back(autogenBuildDir + "moc_compilation.cpp");
   }
 
   // Initialize autogen target dependencies
@@ -770,35 +770,33 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   }
 #endif
 
-  bool const isNinja = lg->GetGlobalGenerator()->GetName() == "Ninja";
-  if (isNinja
+  if (target->GetPropertyAsBool("AUTORCC")) {
+    cmFilePathChecksum fpathCheckSum(makefile);
+    std::vector<cmSourceFile*> srcFiles;
+    target->GetConfigCommonSourceFiles(srcFiles);
+    for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+         fileIt != srcFiles.end(); ++fileIt) {
+      cmSourceFile* sf = *fileIt;
+      if (sf->GetExtension() == "qrc" &&
+          !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
+        {
+          const std::string absFile =
+            cmsys::SystemTools::GetRealPath(sf->GetFullPath());
+
+          std::string rccOutputFile = autogenBuildDir;
+          rccOutputFile += fpathCheckSum.getPart(absFile);
+          rccOutputFile += "/qrc_";
+          rccOutputFile +=
+            cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
+          rccOutputFile += ".cpp";
+          // Register rcc output file as generated
+          autogenOutputFiles.push_back(rccOutputFile);
+        }
+        if (lg->GetGlobalGenerator()->GetName() == "Ninja"
 #if defined(_WIN32) && !defined(__CYGWIN__)
-      || usePRE_BUILD
+            || usePRE_BUILD
 #endif
-      ) {
-    if (target->GetPropertyAsBool("AUTORCC")) {
-      cmFilePathChecksum fpathCheckSum(makefile);
-      std::vector<cmSourceFile*> srcFiles;
-      target->GetConfigCommonSourceFiles(srcFiles);
-      for (std::vector<cmSourceFile*>::const_iterator fileIt =
-             srcFiles.begin();
-           fileIt != srcFiles.end(); ++fileIt) {
-        cmSourceFile* sf = *fileIt;
-        if (sf->GetExtension() == "qrc" &&
-            !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
-          {
-            const std::string absFile =
-              cmsys::SystemTools::GetRealPath(sf->GetFullPath());
-
-            std::string rccOutputFile = GetAutogenTargetBuildDir(target);
-            rccOutputFile += fpathCheckSum.getPart(absFile);
-            rccOutputFile += "/qrc_";
-            rccOutputFile +=
-              cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
-            rccOutputFile += ".cpp";
-            // Register rcc output file as generated
-            autogenOutputFiles.push_back(rccOutputFile);
-          }
+            ) {
           if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
             RccListInputs(qtMajorVersion, sf, target, depends);
 #if defined(_WIN32) && !defined(__CYGWIN__)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f437f3c35ae13c147e0d022a84774750d4a0a7a
commit 8f437f3c35ae13c147e0d022a84774750d4a0a7a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 17:20:25 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:03 2016 -0500

    QtAutogen: Add moc compilation file to autogen target byproducts
    
    Closes: #16389

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 76fb8e5..3a46ab0 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -679,22 +679,27 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   const std::string workingDirectory =
     cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
   const std::string qtMajorVersion = GetQtMajorVersion(target);
+  std::vector<std::string> autogenOutputFiles;
 
-  // Create autogen target build directory
+  // Create autogen target build directory and add it to the clean files
   cmSystemTools::MakeDirectory(autogenBuildDir);
-  // Remove entire autogen build directory on clean
   makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
                            autogenBuildDir.c_str(), false);
 
-  // Create autogen target includes directory and
-  // add it to the origin target INCLUDE_DIRECTORIES
   if (target->GetPropertyAsBool("AUTOMOC") ||
       target->GetPropertyAsBool("AUTOUIC")) {
+    // Create autogen target includes directory and
+    // add it to the origin target INCLUDE_DIRECTORIES
     const std::string incsDir = autogenBuildDir + "include";
     cmSystemTools::MakeDirectory(incsDir);
     target->AddIncludeDirectory(incsDir, true);
   }
 
+  if (target->GetPropertyAsBool("AUTOMOC")) {
+    // Register moc compilation file as generated
+    autogenOutputFiles.push_back ( autogenBuildDir + "moc_compilation.cpp" );
+  }
+
   // Initialize autogen target dependencies
   std::vector<std::string> depends;
   if (const char* autogenDepends =
@@ -765,7 +770,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   }
 #endif
 
-  std::vector<std::string> rcc_output;
   bool const isNinja = lg->GetGlobalGenerator()->GetName() == "Ninja";
   if (isNinja
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -792,10 +796,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
             rccOutputFile +=
               cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
             rccOutputFile += ".cpp";
-            rcc_output.push_back(rccOutputFile);
-            // Create output directory
-            cmSystemTools::MakeDirectory(
-              cmsys::SystemTools::GetFilenamePath(rccOutputFile));
+            // Register rcc output file as generated
+            autogenOutputFiles.push_back(rccOutputFile);
           }
           if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
             RccListInputs(qtMajorVersion, sf, target, depends);
@@ -829,7 +831,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   {
     cmTarget* autogenTarget = makefile->AddUtilityCommand(
       autogenTargetName, true, workingDirectory.c_str(),
-      /*byproducts=*/rcc_output, depends, commandLines, false,
+      /*byproducts=*/autogenOutputFiles, depends, commandLines, false,
       autogenComment.c_str());
 
     cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=360c3427117312548358fddce906a346f17b8f5f
commit 360c3427117312548358fddce906a346f17b8f5f
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 16:24:51 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:03 2016 -0500

    QtAutogen: Reconfigure when .qrc file changes
    
    Add .qrc files to the CMake depends.
    When the .qrc file changes the build system gets reconfigured
    and the resource files watch list gets updated.

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 889c61d..76fb8e5 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -109,7 +109,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
   std::vector<cmSourceFile*> srcFiles;
   target->GetConfigCommonSourceFiles(srcFiles);
 
-  std::vector<std::string> newRccFiles;
+  std::vector<std::string> rccOutput;
 
   cmFilePathChecksum fpathCheckSum(makefile);
   for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
@@ -127,19 +127,16 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
       if (ext == "qrc" &&
           !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
 
+        // Run cmake again when .qrc file changes
+        makefile->AddCMakeDependFile ( absFile );
+
         std::string rccOutputFile = GetAutogenTargetBuildDir(target);
         rccOutputFile += fpathCheckSum.getPart(absFile);
         rccOutputFile += "/qrc_";
         rccOutputFile +=
           cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
         rccOutputFile += ".cpp";
-
-        makefile->GetOrCreateSource(rccOutputFile, true);
-        newRccFiles.push_back(rccOutputFile);
-
-        // Create output directory
-        cmSystemTools::MakeDirectory(
-          cmsys::SystemTools::GetFilenamePath(rccOutputFile));
+        rccOutput.push_back(rccOutputFile);
       }
     }
 
@@ -158,9 +155,16 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
     }
   }
 
-  for (std::vector<std::string>::const_iterator fileIt = newRccFiles.begin();
-       fileIt != newRccFiles.end(); ++fileIt) {
-    const_cast<cmGeneratorTarget*>(target)->AddSource(*fileIt);
+  // Add rcc output files as sources
+  for (std::vector<std::string>::const_iterator fileIt = rccOutput.begin();
+       fileIt != rccOutput.end(); ++fileIt) {
+    const std::string& rccOutputFile = *fileIt;
+    // Add source
+    makefile->GetOrCreateSource(rccOutputFile, true);
+    const_cast<cmGeneratorTarget*>(target)->AddSource(rccOutputFile);
+    // Create output directory
+    cmSystemTools::MakeDirectory(
+      cmsys::SystemTools::GetFilenamePath(rccOutputFile));
   }
 }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5409d04f1c1309deb7e45163a106c8cb4daf38c
commit b5409d04f1c1309deb7e45163a106c8cb4daf38c
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 13:03:38 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:02 2016 -0500

    QtAutogen: Rename autogen target to *_autogen from *_automoc

diff --git a/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst b/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst
index 5a69ef3..fae5626 100644
--- a/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst
+++ b/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst
@@ -1,7 +1,7 @@
 AUTOGEN_TARGETS_FOLDER
 ----------------------
 
-Name of :prop_tgt:`FOLDER` for ``*_automoc`` targets that are added automatically by
+Name of :prop_tgt:`FOLDER` for ``*_autogen`` targets that are added automatically by
 CMake for targets for which :prop_tgt:`AUTOMOC` is enabled.
 
 If not set, CMake uses the :prop_tgt:`FOLDER` property of the parent target as a
diff --git a/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst b/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst
index 671f86a..17666e4 100644
--- a/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst
+++ b/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst
@@ -1,7 +1,7 @@
 AUTOMOC_TARGETS_FOLDER
 ----------------------
 
-Name of :prop_tgt:`FOLDER` for ``*_automoc`` targets that are added automatically by
+Name of :prop_tgt:`FOLDER` for ``*_autogen`` targets that are added automatically by
 CMake for targets for which :prop_tgt:`AUTOMOC` is enabled.
 
 This property is obsolete.  Use :prop_gbl:`AUTOGEN_TARGETS_FOLDER` instead.
diff --git a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
index 5063244..f522c6b 100644
--- a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
+++ b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
@@ -1,16 +1,16 @@
 AUTOGEN_TARGET_DEPENDS
 ----------------------
 
-Target dependencies of the corresponding ``_automoc`` target.
+Target dependencies of the corresponding ``_autogen`` target.
 
 Targets which have their :prop_tgt:`AUTOMOC` target ``ON`` have a
-corresponding ``_automoc`` target which is used to autogenerate generate moc
-files.  As this ``_automoc`` target is created at generate-time, it is not
+corresponding ``_autogen`` target which is used to autogenerate generate moc
+files.  As this ``_autogen`` target is created at generate-time, it is not
 possible to define dependencies of it, such as to create inputs for the ``moc``
 executable.
 
 The ``AUTOGEN_TARGET_DEPENDS`` target property can be set instead to a list of
-dependencies for the ``_automoc`` target.  The buildsystem will be generated to
+dependencies for the ``_autogen`` target.  The buildsystem will be generated to
 depend on its contents.
 
 See the :manual:`cmake-qt(7)` manual for more information on using CMake
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 7448ec2..889c61d 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -58,7 +58,7 @@ static std::string utilStripCR(std::string const& line)
 static std::string GetAutogenTargetName(cmGeneratorTarget const* target)
 {
   std::string autogenTargetName = target->GetName();
-  autogenTargetName += "_automoc";
+  autogenTargetName += "_autogen";
   return autogenTargetName;
 }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9996aab74836bb830e106bea0b0064a4c74cb1c
commit d9996aab74836bb830e106bea0b0064a4c74cb1c
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:13:59 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:02 2016 -0500

    QtAutogen: Inline single use variable definitions

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index ca7ca8e..7448ec2 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -115,17 +115,14 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
   for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
        fileIt != srcFiles.end(); ++fileIt) {
     cmSourceFile* sf = *fileIt;
-    std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath());
-    bool skipFileForMoc =
-      cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
-    bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"));
+    const std::string absFile =
+      cmsys::SystemTools::GetRealPath(sf->GetFullPath());
+    const std::string ext = sf->GetExtension();
 
     if (cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC"))) {
       skipUic.push_back(absFile);
     }
 
-    std::string ext = sf->GetExtension();
-
     if (target->GetPropertyAsBool("AUTORCC")) {
       if (ext == "qrc" &&
           !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
@@ -146,8 +143,8 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
       }
     }
 
-    if (!generated) {
-      if (skipFileForMoc) {
+    if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
+      if (cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"))) {
         skipMoc.push_back(absFile);
       } else {
         cmSystemTools::FileFormat fileType =

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b770b85d6c05fd36462172e33c8b700b22b801e9
commit b770b85d6c05fd36462172e33c8b700b22b801e9
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:10:51 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:01 2016 -0500

    QtAutogen: Determine the Qt major version in only one way

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index b12045c..ca7ca8e 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -83,6 +83,21 @@ static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
   return targetDir;
 }
 
+static std::string GetQtMajorVersion(cmGeneratorTarget const* target)
+{
+  cmMakefile* makefile = target->Target->GetMakefile();
+  std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+  if (qtMajorVersion.empty()) {
+    qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
+  }
+  const char* targetQtVersion =
+    target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "");
+  if (targetQtVersion != CM_NULLPTR) {
+    qtMajorVersion = targetQtVersion;
+  }
+  return qtMajorVersion;
+}
+
 static void SetupSourceFiles(cmGeneratorTarget const* target,
                              std::vector<std::string>& skipMoc,
                              std::vector<std::string>& mocSources,
@@ -355,25 +370,13 @@ static void UicSetupAutoTarget(
   }
 }
 
-static std::string RccGetExecutable(cmGeneratorTarget const* target)
+static std::string RccGetExecutable(cmGeneratorTarget const* target,
+                                    const std::string& qtMajorVersion)
 {
   cmLocalGenerator* lg = target->GetLocalGenerator();
-  cmMakefile* makefile = target->Target->GetMakefile();
-  const char* qtVersion = makefile->GetDefinition("_target_qt_version");
-  if (!qtVersion) {
-    qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
-    if (!qtVersion) {
-      qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
-    }
-    if (const char* targetQtVersion =
-          target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION",
-                                                          "")) {
-      qtVersion = targetQtVersion;
-    }
-  }
 
-  std::string targetName = target->GetName();
-  if (strcmp(qtVersion, "5") == 0) {
+  std::string const& targetName = target->GetName();
+  if (qtMajorVersion == "5") {
     cmGeneratorTarget* qt5Rcc = lg->FindGeneratorTargetToUse("Qt5::rcc");
     if (!qt5Rcc) {
       cmSystemTools::Error("Qt5::rcc target not found ", targetName.c_str());
@@ -381,7 +384,7 @@ static std::string RccGetExecutable(cmGeneratorTarget const* target)
     }
     return qt5Rcc->ImportedGetLocation("");
   }
-  if (strcmp(qtVersion, "4") == 0) {
+  if (qtMajorVersion == "4") {
     cmGeneratorTarget* qt4Rcc = lg->FindGeneratorTargetToUse("Qt4::rcc");
     if (!qt4Rcc) {
       cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str());
@@ -433,7 +436,11 @@ static void RccMergeOptions(std::vector<std::string>& opts,
 static bool RccListInputsQt5(cmSourceFile* sf, cmGeneratorTarget const* target,
                              std::vector<std::string>& depends)
 {
-  const std::string rccCommand = RccGetExecutable(target);
+  const std::string rccCommand = RccGetExecutable(target, "5");
+  if (rccCommand.empty()) {
+    cmSystemTools::Error("AUTOGEN: error: rcc executable not available\n");
+    return false;
+  }
 
   bool hasDashDashList = false;
   // Read rcc features
@@ -562,7 +569,8 @@ static bool RccListInputs(const std::string& qtMajorVersion, cmSourceFile* sf,
   return RccListInputsQt4(sf, depends);
 }
 
-static void RccSetupAutoTarget(cmGeneratorTarget const* target)
+static void RccSetupAutoTarget(cmGeneratorTarget const* target,
+                               const std::string& qtMajorVersion)
 {
   std::string _rcc_files;
   const char* sepRccFiles = "";
@@ -578,16 +586,12 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
   std::string rccFileOptions;
   const char* optionSep = "";
 
-  const char* qtVersion = makefile->GetDefinition("_target_qt_version");
+  const bool qtMajorVersion5 = (qtMajorVersion == "5");
 
   std::vector<std::string> rccOptions;
   if (const char* opts = target->GetProperty("AUTORCC_OPTIONS")) {
     cmSystemTools::ExpandListArgument(opts, rccOptions);
   }
-  std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
-  if (qtMajorVersion == "") {
-    qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
-  }
 
   for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
        fileIt != srcFiles.end(); ++fileIt) {
@@ -605,7 +609,7 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
         if (const char* prop = sf->GetProperty("AUTORCC_OPTIONS")) {
           std::vector<std::string> optsVec;
           cmSystemTools::ExpandListArgument(prop, optsVec);
-          RccMergeOptions(rccOptions, optsVec, strcmp(qtVersion, "5") == 0);
+          RccMergeOptions(rccOptions, optsVec, qtMajorVersion5);
         }
 
         if (!rccOptions.empty()) {
@@ -648,7 +652,7 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
     "_rcc_options_options",
     cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
   makefile->AddDefinition("_qt_rcc_executable",
-                          RccGetExecutable(target).c_str());
+                          RccGetExecutable(target, qtMajorVersion).c_str());
 }
 
 void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
@@ -673,11 +677,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
   const std::string workingDirectory =
     cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
-
-  std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
-  if (qtMajorVersion == "") {
-    qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
-  }
+  const std::string qtMajorVersion = GetQtMajorVersion(target);
 
   // Create autogen target build directory
   cmSystemTools::MakeDirectory(autogenBuildDir);
@@ -863,6 +863,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
 
   // create a custom target for running generators at buildtime:
   const std::string autogenTargetName = GetAutogenTargetName(target);
+  const std::string qtMajorVersion = GetQtMajorVersion(target);
 
   makefile->AddDefinition(
     "_moc_target_name",
@@ -870,19 +871,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
   makefile->AddDefinition(
     "_origin_target_name",
     cmOutputConverter::EscapeForCMake(target->GetName()).c_str());
-
-  const char* qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
-  if (!qtVersion) {
-    qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
-  }
-  if (const char* targetQtVersion =
-        target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION",
-                                                        "")) {
-    qtVersion = targetQtVersion;
-  }
-  if (qtVersion) {
-    makefile->AddDefinition("_target_qt_version", qtVersion);
-  }
+  makefile->AddDefinition("_target_qt_version", qtMajorVersion.c_str());
 
   std::vector<std::string> skipUic;
   std::vector<std::string> skipMoc;
@@ -908,7 +897,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
     UicSetupAutoTarget(target, skipUic, configUicOptions);
   }
   if (target->GetPropertyAsBool("AUTORCC")) {
-    RccSetupAutoTarget(target);
+    RccSetupAutoTarget(target, qtMajorVersion);
   }
 
   // Generate config file

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c3dc7460ea6644bd658131ec474e6ddce825b1a
commit 5c3dc7460ea6644bd658131ec474e6ddce825b1a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 11:32:12 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:01 2016 -0500

    QtAutogen: Clean removes autogen build directory
    
    Cleaning removes the entire autogen build directory instead
    of single files.

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index bc75c59..b12045c 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -122,8 +122,6 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
           cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
         rccOutputFile += ".cpp";
 
-        makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
-                                 rccOutputFile.c_str(), false);
         makefile->GetOrCreateSource(rccOutputFile, true);
         newRccFiles.push_back(rccOutputFile);
 
@@ -661,9 +659,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
     const std::string mocCppFile =
       GetAutogenTargetBuildDir(target) + "moc_compilation.cpp";
     makefile->GetOrCreateSource(mocCppFile, true);
-    makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(),
-                             false);
-
     target->AddSource(mocCppFile);
   }
 }
@@ -686,6 +681,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
   // Create autogen target build directory
   cmSystemTools::MakeDirectory(autogenBuildDir);
+  // Remove entire autogen build directory on clean
+  makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+                           autogenBuildDir.c_str(), false);
 
   // Create autogen target includes directory and
   // add it to the origin target INCLUDE_DIRECTORIES

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c9358386b0b2826ffc3da4385474a4227477eef
commit 8c9358386b0b2826ffc3da4385474a4227477eef
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 11:21:52 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:01 2016 -0500

    QtAutogen: Generate included ui_ and moc_ files in _automoc/includes
    
    ui_ and moc_ files that are include in source files get generated in
    $CURRENT_BUILD_DIR/$TARGETNAME_automoc/include.
    The directory is added to the INCLUDE_DIRECTORIES of the origin target
    in the generation stage.
    
    From now on all autogen files get generated below
    $CURRENT_BUILD_DIR/$TARGETNAME_automoc.

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 9766a5a..bc75c59 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -658,8 +658,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
 {
   if (target->GetPropertyAsBool("AUTOMOC")) {
     cmMakefile* makefile = target->Target->GetMakefile();
-    std::string mocCppFile = GetAutogenTargetBuildDir(target);
-    mocCppFile += "moc_compilation.cpp";
+    const std::string mocCppFile =
+      GetAutogenTargetBuildDir(target) + "moc_compilation.cpp";
     makefile->GetOrCreateSource(mocCppFile, true);
     makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(),
                              false);
@@ -675,6 +675,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
   // Create a custom target for running generators at buildtime
   const std::string autogenTargetName = GetAutogenTargetName(target);
+  const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
   const std::string workingDirectory =
     cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
 
@@ -683,6 +684,18 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
     qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
   }
 
+  // Create autogen target build directory
+  cmSystemTools::MakeDirectory(autogenBuildDir);
+
+  // Create autogen target includes directory and
+  // add it to the origin target INCLUDE_DIRECTORIES
+  if (target->GetPropertyAsBool("AUTOMOC") ||
+      target->GetPropertyAsBool("AUTOUIC")) {
+    const std::string incsDir = autogenBuildDir + "include";
+    cmSystemTools::MakeDirectory(incsDir);
+    target->AddIncludeDirectory(incsDir, true);
+  }
+
   // Initialize autogen target dependencies
   std::vector<std::string> depends;
   if (const char* autogenDepends =
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index bb18e2e..ee5eb11 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -986,8 +986,8 @@ void cmQtAutoGenerators::ParseHeaders(
 
       std::string macroName;
       if (requiresMocing(contents, macroName)) {
-        notIncludedMocs[headerName] = this->TargetBuildSubDir +
-          fpathCheckSum.getPart(headerName) + "/moc_" +
+        notIncludedMocs[headerName] = fpathCheckSum.getPart(headerName) +
+          "/moc_" +
           cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName) +
           ".cpp";
       }
@@ -1021,26 +1021,32 @@ bool cmQtAutoGenerators::GenerateMocFiles(
   }
 
   // generate moc files that are included by source files.
-  for (std::map<std::string, std::string>::const_iterator it =
-         includedMocs.begin();
-       it != includedMocs.end(); ++it) {
-    if (!this->GenerateMoc(it->first, it->second)) {
-      if (this->RunMocFailed) {
-        return false;
+  {
+    const std::string subDirPrefix = "include/";
+    for (std::map<std::string, std::string>::const_iterator it =
+           includedMocs.begin();
+         it != includedMocs.end(); ++it) {
+      if (!this->GenerateMoc(it->first, it->second, subDirPrefix)) {
+        if (this->RunMocFailed) {
+          return false;
+        }
       }
     }
   }
 
   // generate moc files that are _not_ included by source files.
   bool automocCppChanged = false;
-  for (std::map<std::string, std::string>::const_iterator it =
-         notIncludedMocs.begin();
-       it != notIncludedMocs.end(); ++it) {
-    if (this->GenerateMoc(it->first, it->second)) {
-      automocCppChanged = true;
-    } else {
-      if (this->RunMocFailed) {
-        return false;
+  {
+    const std::string subDirPrefix;
+    for (std::map<std::string, std::string>::const_iterator it =
+           notIncludedMocs.begin();
+         it != notIncludedMocs.end(); ++it) {
+      if (this->GenerateMoc(it->first, it->second, subDirPrefix)) {
+        automocCppChanged = true;
+      } else {
+        if (this->RunMocFailed) {
+          return false;
+        }
       }
     }
   }
@@ -1054,13 +1060,11 @@ bool cmQtAutoGenerators::GenerateMocFiles(
       // Dummy content
       outStream << "enum some_compilers { need_more_than_nothing };\n";
     } else {
-      // Includes content
+      // Valid content
       for (std::map<std::string, std::string>::const_iterator it =
              notIncludedMocs.begin();
            it != notIncludedMocs.end(); ++it) {
-        outStream << "#include \""
-                  << it->second.substr(this->TargetBuildSubDir.size())
-                  << "\"\n";
+        outStream << "#include \"" << it->second << "\"\n";
       }
     }
     outStream.flush();
@@ -1117,21 +1121,21 @@ bool cmQtAutoGenerators::GenerateMocFiles(
  * @return True if a moc file was created. False may indicate an error.
  */
 bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
-                                     const std::string& mocFileName)
+                                     const std::string& mocFileName,
+                                     const std::string& subDirPrefix)
 {
-  const std::string mocFilePath = this->Builddir + mocFileName;
+  const std::string mocFileRel =
+    this->TargetBuildSubDir + subDirPrefix + mocFileName;
+  const std::string mocFileAbs = this->Builddir + mocFileRel;
   int sourceNewerThanMoc = 0;
-  bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFilePath,
+  bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs,
                                                      &sourceNewerThanMoc);
   if (this->GenerateAll || !success || sourceNewerThanMoc >= 0) {
-    {
-      std::string msg = "Generating MOC source ";
-      msg += mocFileName;
-      this->LogBold(msg);
-    }
+    // Log
+    this->LogBold("Generating MOC source " + mocFileRel);
 
     // Make sure the parent directory exists
-    if (!this->makeParentDirectory(mocFilePath)) {
+    if (!this->makeParentDirectory(mocFileAbs)) {
       this->RunMocFailed = true;
       return false;
     }
@@ -1148,7 +1152,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
     command.push_back("-DWIN32");
 #endif
     command.push_back("-o");
-    command.push_back(mocFilePath);
+    command.push_back(mocFileAbs);
     command.push_back(sourceFile);
 
     if (this->Verbose) {
@@ -1162,12 +1166,11 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
     if (!result || retVal) {
       {
         std::ostringstream err;
-        err << "AUTOGEN: error: moc process for " << mocFilePath
-            << " failed:\n"
+        err << "AUTOGEN: error: moc process for " << mocFileRel << " failed:\n"
             << output << std::endl;
         this->LogError(err.str());
       }
-      cmSystemTools::RemoveFile(mocFilePath);
+      cmSystemTools::RemoveFile(mocFileAbs);
       this->RunMocFailed = true;
       return false;
     }
@@ -1242,20 +1245,19 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
                                     const std::string& uiInputFile,
                                     const std::string& uiOutputFile)
 {
-  const std::string uiBuildFile = this->Builddir + uiOutputFile;
+  const std::string uicFileRel =
+    this->TargetBuildSubDir + "include/" + uiOutputFile;
+  const std::string uicFileAbs = this->Builddir + uicFileRel;
 
   int sourceNewerThanUi = 0;
-  bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uiBuildFile,
+  bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uicFileAbs,
                                                      &sourceNewerThanUi);
   if (this->GenerateAll || !success || sourceNewerThanUi >= 0) {
-    {
-      std::string msg = "Generating UIC header ";
-      msg += uiOutputFile;
-      this->LogBold(msg);
-    }
+    // Log
+    this->LogBold("Generating UIC header " + uicFileRel);
 
     // Make sure the parent directory exists
-    if (!this->makeParentDirectory(uiBuildFile)) {
+    if (!this->makeParentDirectory(uicFileAbs)) {
       this->RunUicFailed = true;
       return false;
     }
@@ -1275,7 +1277,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
     command.insert(command.end(), opts.begin(), opts.end());
 
     command.push_back("-o");
-    command.push_back(uiBuildFile);
+    command.push_back(uicFileAbs);
     command.push_back(uiInputFile);
 
     if (this->Verbose) {
@@ -1288,12 +1290,12 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
     if (!result || retVal) {
       {
         std::ostringstream err;
-        err << "AUTOUIC: error: uic process for " << uiOutputFile
+        err << "AUTOUIC: error: uic process for " << uicFileRel
             << " needed by\n \"" << realName << "\"\nfailed:\n"
             << output << std::endl;
         this->LogError(err.str());
       }
-      cmSystemTools::RemoveFile(uiOutputFile);
+      cmSystemTools::RemoveFile(uicFileAbs);
       this->RunUicFailed = true;
       return false;
     }
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 302c9be..5fbaf87 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -31,15 +31,19 @@ private:
   std::string MakeCompileSettingsString(cmMakefile* makefile);
 
   bool RunAutogen(cmMakefile* makefile);
+
   bool GenerateMocFiles(
     const std::map<std::string, std::string>& includedMocs,
     const std::map<std::string, std::string>& notIncludedMocs);
   bool GenerateMoc(const std::string& sourceFile,
-                   const std::string& mocFileName);
+                   const std::string& mocFileName,
+                   const std::string& subDirPrefix);
+
   bool GenerateUiFiles(
     const std::map<std::string, std::vector<std::string> >& includedUis);
   bool GenerateUi(const std::string& realName, const std::string& uiInputFile,
                   const std::string& uiOutputFile);
+
   bool GenerateQrcFiles();
   bool GenerateQrc(const std::string& qrcInputFile,
                    const std::string& qrcOutputFile, bool unique_n);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f47a5f16aa685e15e6b49c0b90a58b18ea38d0a
commit 8f47a5f16aa685e15e6b49c0b90a58b18ea38d0a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Dec 1 18:15:32 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:00 2016 -0500

    cmGeneratorTarget: Add AddIncludeDirectory method (experimental)

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 903bcec..6ee2c14 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -533,6 +533,21 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
   }
 }
 
+void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
+                                            bool before)
+{
+  this->Target->InsertInclude(src, this->Makefile->GetBacktrace(), before);
+  cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+  cmGeneratorExpression ge(lfbt);
+  CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
+  cge->SetEvaluateForBuildsystem(true);
+  // Insert before begin/end
+  std::vector<TargetPropertyEntry*>::iterator pos = before
+    ? this->IncludeDirectoriesEntries.begin()
+    : this->IncludeDirectoriesEntries.end();
+  this->IncludeDirectoriesEntries.insert(pos, new TargetPropertyEntry(cge));
+}
+
 std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
   cmSourceFile const* sf) const
 {
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 4c3c14b..f568699 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -396,6 +396,12 @@ public:
   void AddTracedSources(std::vector<std::string> const& srcs);
 
   /**
+   * Adds an entry to the INCLUDE_DIRECTORIES list.
+   * If before is true the entry is pushed at the front.
+   */
+  void AddIncludeDirectory(const std::string& src, bool before = false);
+
+  /**
    * Flags for a given source file as used in this target. Typically assigned
    * via SET_TARGET_PROPERTIES when the property is a list of source files.
    */

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=057ac11bfbc5501c8037b173a73a55466163774d
commit 057ac11bfbc5501c8037b173a73a55466163774d
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Dec 1 09:24:48 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:24:00 2016 -0500

    QtAutogen: Use checksum based subdirectories to avoid name collisions

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 5b381b4..d15fdbe 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -243,8 +243,8 @@ set(SRCS
   cmFileLockPool.h
   cmFileLockResult.cxx
   cmFileLockResult.h
-  cmFilePathUuid.cxx
-  cmFilePathUuid.h
+  cmFilePathChecksum.cxx
+  cmFilePathChecksum.h
   cmFileTimeComparison.cxx
   cmFileTimeComparison.h
   cmFortranLexer.cxx
diff --git a/Source/cmFilePathChecksum.cxx b/Source/cmFilePathChecksum.cxx
new file mode 100644
index 0000000..3d8b695
--- /dev/null
+++ b/Source/cmFilePathChecksum.cxx
@@ -0,0 +1,88 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#include "cmFilePathChecksum.h"
+
+#include "cmBase32.h"
+#include "cmCryptoHash.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+#include <vector>
+
+cmFilePathChecksum::cmFilePathChecksum()
+{
+}
+
+cmFilePathChecksum::cmFilePathChecksum(const std::string& currentSrcDir,
+                                       const std::string& currentBinDir,
+                                       const std::string& projectSrcDir,
+                                       const std::string& projectBinDir)
+{
+  setupParentDirs(currentSrcDir, currentBinDir, projectSrcDir, projectBinDir);
+}
+
+cmFilePathChecksum::cmFilePathChecksum(cmMakefile* makefile)
+{
+  setupParentDirs(makefile->GetCurrentSourceDirectory(),
+                  makefile->GetCurrentBinaryDirectory(),
+                  makefile->GetHomeDirectory(),
+                  makefile->GetHomeOutputDirectory());
+}
+
+void cmFilePathChecksum::setupParentDirs(const std::string& currentSrcDir,
+                                         const std::string& currentBinDir,
+                                         const std::string& projectSrcDir,
+                                         const std::string& projectBinDir)
+{
+  parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
+  parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
+  parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
+  parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
+
+  parentDirs[0].second = "CurrentSource";
+  parentDirs[1].second = "CurrentBinary";
+  parentDirs[2].second = "ProjectSource";
+  parentDirs[3].second = "ProjectBinary";
+}
+
+std::string cmFilePathChecksum::get(const std::string& filePath)
+{
+  std::string relPath;
+  std::string relSeed;
+  {
+    const std::string fileReal = cmsys::SystemTools::GetRealPath(filePath);
+    std::string parentDir;
+    // Find closest project parent directory
+    for (size_t ii = 0; ii != numParentDirs; ++ii) {
+      const std::string& pDir = parentDirs[ii].first;
+      if (!pDir.empty() &&
+          cmsys::SystemTools::IsSubDirectory(fileReal, pDir)) {
+        relSeed = parentDirs[ii].second;
+        parentDir = pDir;
+        break;
+      }
+    }
+    // Use file system root as fallback parent directory
+    if (parentDir.empty()) {
+      relSeed = "FileSystemRoot";
+      cmsys::SystemTools::SplitPathRootComponent(fileReal, &parentDir);
+    }
+    // Calculate relative path from project parent directory
+    relPath = cmsys::SystemTools::RelativePath(
+      parentDir, cmsys::SystemTools::GetParentDirectory(fileReal));
+  }
+
+  // Calculate the file ( seed + relative path ) binary checksum
+  std::vector<unsigned char> hashBytes =
+    cmCryptoHash(cmCryptoHash::AlgoSHA256).ByteHashString(relSeed + relPath);
+
+  // Convert binary checksum to string
+  return cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(),
+                                        false);
+}
+
+std::string cmFilePathChecksum::getPart(const std::string& filePath,
+                                        size_t length)
+{
+  return get(filePath).substr(0, length);
+}
diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h
new file mode 100644
index 0000000..df19053
--- /dev/null
+++ b/Source/cmFilePathChecksum.h
@@ -0,0 +1,65 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#ifndef cmFilePathChecksum_h
+#define cmFilePathChecksum_h
+
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <stddef.h>
+#include <string>
+#include <utility>
+
+class cmMakefile;
+
+/** \class cmFilePathChecksum
+ * @brief Generates a checksum for the parent directory of a file
+ *
+ * The checksum is calculated from the relative file path to the
+ * closest known project directory. This guarantees reproducibility
+ * when source and build directory differ e.g. for different project
+ * build directories.
+ */
+class cmFilePathChecksum
+{
+public:
+  /// Maximum number of characters to use from the path checksum
+  static const size_t partLengthDefault = 10;
+
+  /// @brief Parent directories are empty
+  cmFilePathChecksum();
+
+  /// @brief Initilizes the parent directories manually
+  cmFilePathChecksum(const std::string& currentSrcDir,
+                     const std::string& currentBinDir,
+                     const std::string& projectSrcDir,
+                     const std::string& projectBinDir);
+
+  /// @brief Initilizes the parent directories from a makefile
+  cmFilePathChecksum(cmMakefile* makefile);
+
+  /// @brief Allows parent directories setup after construction
+  ///
+  void setupParentDirs(const std::string& currentSrcDir,
+                       const std::string& currentBinDir,
+                       const std::string& projectSrcDir,
+                       const std::string& projectBinDir);
+
+  /* @brief Calculates the path checksum for the parent directory of a file
+   *
+   */
+  std::string get(const std::string& filePath);
+
+  /* @brief Same as get() but returns only the first length characters
+   *
+   */
+  std::string getPart(const std::string& filePath,
+                      size_t length = partLengthDefault);
+
+private:
+  /// Size of the parent directory list
+  static const size_t numParentDirs = 4;
+  /// List of (directory name, seed name) pairs
+  std::pair<std::string, std::string> parentDirs[numParentDirs];
+};
+
+#endif
diff --git a/Source/cmFilePathUuid.cxx b/Source/cmFilePathUuid.cxx
deleted file mode 100644
index 03d2524..0000000
--- a/Source/cmFilePathUuid.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-#include "cmFilePathUuid.h"
-
-#include "cmBase32.h"
-#include "cmCryptoHash.h"
-#include "cmMakefile.h"
-#include "cmSystemTools.h"
-
-#include <vector>
-
-cmFilePathUuid::cmFilePathUuid(cmMakefile* makefile)
-{
-  initParentDirs(makefile->GetCurrentSourceDirectory(),
-                 makefile->GetCurrentBinaryDirectory(),
-                 makefile->GetHomeDirectory(),
-                 makefile->GetHomeOutputDirectory());
-}
-
-cmFilePathUuid::cmFilePathUuid(const std::string& currentSrcDir,
-                               const std::string& currentBinDir,
-                               const std::string& projectSrcDir,
-                               const std::string& projectBinDir)
-{
-  initParentDirs(currentSrcDir, currentBinDir, projectSrcDir, projectBinDir);
-}
-
-void cmFilePathUuid::initParentDirs(const std::string& currentSrcDir,
-                                    const std::string& currentBinDir,
-                                    const std::string& projectSrcDir,
-                                    const std::string& projectBinDir)
-{
-  parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
-  parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
-  parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
-  parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
-
-  parentDirs[0].second = "CurrentSource";
-  parentDirs[1].second = "CurrentBinary";
-  parentDirs[2].second = "ProjectSource";
-  parentDirs[3].second = "ProjectBinary";
-}
-
-std::string cmFilePathUuid::get(const std::string& filePath,
-                                const char* outputPrefix,
-                                const char* outputSuffix)
-{
-  std::string sourceFilename = cmsys::SystemTools::GetFilenameName(filePath);
-  std::string sourceBasename =
-    cmsys::SystemTools::GetFilenameWithoutLastExtension(sourceFilename);
-
-  // Acquire checksum string
-  std::string checksum;
-  {
-    std::string sourceRelPath;
-    std::string sourceRelSeed;
-    GetRelPathSeed(filePath, sourceRelPath, sourceRelSeed);
-    checksum = GetChecksumString(sourceFilename, sourceRelPath, sourceRelSeed);
-  }
-
-  // Compose the file name
-  std::string uuid;
-  if (outputPrefix) {
-    uuid += outputPrefix;
-  }
-  uuid += sourceBasename.substr(0, partLengthName);
-  uuid += "_";
-  uuid += checksum.substr(0, partLengthCheckSum);
-  if (outputSuffix) {
-    uuid += outputSuffix;
-  }
-  return uuid;
-}
-
-void cmFilePathUuid::GetRelPathSeed(const std::string& filePath,
-                                    std::string& sourceRelPath,
-                                    std::string& sourceRelSeed)
-{
-  const std::string sourceNameReal = cmsys::SystemTools::GetRealPath(filePath);
-  std::string parentDirectory;
-  // Find closest project parent directory
-  for (size_t ii = 0; ii != numParentDirs; ++ii) {
-    const std::string& pDir = parentDirs[ii].first;
-    if (!pDir.empty() &&
-        cmsys::SystemTools::IsSubDirectory(sourceNameReal, pDir)) {
-      sourceRelSeed = parentDirs[ii].second;
-      parentDirectory = pDir;
-      break;
-    }
-  }
-  // Check if the file path is below a known project directory
-  if (parentDirectory.empty()) {
-    // Use file syste root as fallback parent directory
-    sourceRelSeed = "FileSystemRoot";
-    cmsys::SystemTools::SplitPathRootComponent(sourceNameReal,
-                                               &parentDirectory);
-  }
-  sourceRelPath = cmsys::SystemTools::RelativePath(
-    parentDirectory, cmsys::SystemTools::GetParentDirectory(sourceNameReal));
-}
-
-std::string cmFilePathUuid::GetChecksumString(
-  const std::string& sourceFilename, const std::string& sourceRelPath,
-  const std::string& sourceRelSeed)
-{
-  std::string checksumBase32;
-  {
-    // Calculate the file ( seed + relative path + name ) checksum
-    std::vector<unsigned char> hashBytes =
-      cmCryptoHash(cmCryptoHash::AlgoSHA256)
-        .ByteHashString(sourceRelSeed + sourceRelPath + sourceFilename);
-
-    checksumBase32 =
-      cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(), false);
-  }
-
-  return checksumBase32;
-}
diff --git a/Source/cmFilePathUuid.h b/Source/cmFilePathUuid.h
deleted file mode 100644
index a450526..0000000
--- a/Source/cmFilePathUuid.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-#ifndef cmFilePathUuid_h
-#define cmFilePathUuid_h
-
-#include <cmConfigure.h> // IWYU pragma: keep
-
-#include <stddef.h>
-#include <string>
-#include <utility>
-
-class cmMakefile;
-
-/** \class cmFilePathUuid
- * @brief Generates a unique pathless file name with a checksum component
- *        calculated from the file path.
- *
- * The checksum is calculated from the relative file path to the
- * closest known project directory. This guarantees reproducibility
- * when source and build directory differ e.g. for different project
- * build directories.
- */
-class cmFilePathUuid
-{
-public:
-  /// Maximum number of characters to use from the file name
-  static const size_t partLengthName = 14;
-  /// Maximum number of characters to use from the path checksum
-  static const size_t partLengthCheckSum = 14;
-
-  /// @brief Initilizes the parent directories from a makefile
-  cmFilePathUuid(cmMakefile* makefile);
-
-  /// @brief Initilizes the parent directories manually
-  cmFilePathUuid(const std::string& currentSrcDir,
-                 const std::string& currentBinDir,
-                 const std::string& projectSrcDir,
-                 const std::string& projectBinDir);
-
-  /* @brief Calculates and returns the uuid for a file path
-   *
-   * @arg outputPrefix optional string to prepend to the result
-   * @arg outputSuffix optional string to append to the result
-   */
-  std::string get(const std::string& filePath,
-                  const char* outputPrefix = CM_NULLPTR,
-                  const char* outputSuffix = CM_NULLPTR);
-
-private:
-  void initParentDirs(const std::string& currentSrcDir,
-                      const std::string& currentBinDir,
-                      const std::string& projectSrcDir,
-                      const std::string& projectBinDir);
-
-  /// Returns the relative path and the parent directory key string (seed)
-  void GetRelPathSeed(const std::string& filePath, std::string& sourceRelPath,
-                      std::string& sourceRelSeed);
-
-  std::string GetChecksumString(const std::string& sourceFilename,
-                                const std::string& sourceRelPath,
-                                const std::string& sourceRelSeed);
-
-  /// Size of the parent directory list
-  static const size_t numParentDirs = 4;
-  /// List of (directory name, seed name) pairs
-  std::pair<std::string, std::string> parentDirs[numParentDirs];
-};
-
-#endif
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index e589a5a..9766a5a 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -4,7 +4,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmCustomCommandLines.h"
-#include "cmFilePathUuid.h"
+#include "cmFilePathChecksum.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
@@ -96,7 +96,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
 
   std::vector<std::string> newRccFiles;
 
-  cmFilePathUuid fpathUuid(makefile);
+  cmFilePathChecksum fpathCheckSum(makefile);
   for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
        fileIt != srcFiles.end(); ++fileIt) {
     cmSourceFile* sf = *fileIt;
@@ -115,15 +115,21 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
       if (ext == "qrc" &&
           !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
 
-        std::string rcc_output_file = GetAutogenTargetBuildDir(target);
-        // Create output directory
-        cmSystemTools::MakeDirectory(rcc_output_file.c_str());
-        rcc_output_file += fpathUuid.get(absFile, "qrc_", ".cpp");
+        std::string rccOutputFile = GetAutogenTargetBuildDir(target);
+        rccOutputFile += fpathCheckSum.getPart(absFile);
+        rccOutputFile += "/qrc_";
+        rccOutputFile +=
+          cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
+        rccOutputFile += ".cpp";
 
         makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
-                                 rcc_output_file.c_str(), false);
-        makefile->GetOrCreateSource(rcc_output_file, true);
-        newRccFiles.push_back(rcc_output_file);
+                                 rccOutputFile.c_str(), false);
+        makefile->GetOrCreateSource(rccOutputFile, true);
+        newRccFiles.push_back(rccOutputFile);
+
+        // Create output directory
+        cmSystemTools::MakeDirectory(
+          cmsys::SystemTools::GetFilenamePath(rccOutputFile));
       }
     }
 
@@ -755,9 +761,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 #endif
       ) {
     if (target->GetPropertyAsBool("AUTORCC")) {
+      cmFilePathChecksum fpathCheckSum(makefile);
       std::vector<cmSourceFile*> srcFiles;
       target->GetConfigCommonSourceFiles(srcFiles);
-      cmFilePathUuid fpathUuid(makefile);
       for (std::vector<cmSourceFile*>::const_iterator fileIt =
              srcFiles.begin();
            fileIt != srcFiles.end(); ++fileIt) {
@@ -767,11 +773,17 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
           {
             const std::string absFile =
               cmsys::SystemTools::GetRealPath(sf->GetFullPath());
-            std::string rcc_output_file = GetAutogenTargetBuildDir(target);
+
+            std::string rccOutputFile = GetAutogenTargetBuildDir(target);
+            rccOutputFile += fpathCheckSum.getPart(absFile);
+            rccOutputFile += "/qrc_";
+            rccOutputFile +=
+              cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
+            rccOutputFile += ".cpp";
+            rcc_output.push_back(rccOutputFile);
             // Create output directory
-            cmSystemTools::MakeDirectory(rcc_output_file.c_str());
-            rcc_output_file += fpathUuid.get(absFile, "qrc_", ".cpp");
-            rcc_output.push_back(rcc_output_file);
+            cmSystemTools::MakeDirectory(
+              cmsys::SystemTools::GetFilenamePath(rccOutputFile));
           }
           if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
             RccListInputs(qtMajorVersion, sf, target, depends);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index bd01d50..bb18e2e 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -15,7 +15,6 @@
 #include <utility>
 
 #include "cmAlgorithms.h"
-#include "cmFilePathUuid.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
@@ -397,6 +396,11 @@ void cmQtAutoGenerators::Init()
 
   this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
 
+  // Init file path checksum generator
+  fpathCheckSum.setupParentDirs(this->Srcdir, this->Builddir,
+                                this->ProjectSourceDir,
+                                this->ProjectBinaryDir);
+
   std::vector<std::string> cdefList;
   cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList);
   for (std::vector<std::string>::const_iterator it = cdefList.begin();
@@ -967,8 +971,6 @@ void cmQtAutoGenerators::ParseHeaders(
   std::map<std::string, std::string>& notIncludedMocs,
   std::map<std::string, std::vector<std::string> >& includedUis)
 {
-  cmFilePathUuid fpathUuid(this->Srcdir, this->Builddir,
-                           this->ProjectSourceDir, this->ProjectBinaryDir);
   for (std::set<std::string>::const_iterator hIt = absHeaders.begin();
        hIt != absHeaders.end(); ++hIt) {
     const std::string& headerName = *hIt;
@@ -984,8 +986,10 @@ void cmQtAutoGenerators::ParseHeaders(
 
       std::string macroName;
       if (requiresMocing(contents, macroName)) {
-        notIncludedMocs[headerName] =
-          this->TargetBuildSubDir + fpathUuid.get(headerName, "moc_", ".cpp");
+        notIncludedMocs[headerName] = this->TargetBuildSubDir +
+          fpathCheckSum.getPart(headerName) + "/moc_" +
+          cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName) +
+          ".cpp";
       }
     }
     this->ParseForUic(headerName, contents, includedUis);
@@ -1318,18 +1322,13 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
 {
   // generate single map with input / output names
   std::map<std::string, std::string> qrcGenMap;
-  {
-    cmFilePathUuid fpathUuid(this->Srcdir, this->Builddir,
-                             this->ProjectSourceDir, this->ProjectBinaryDir);
-    for (std::vector<std::string>::const_iterator si =
-           this->RccSources.begin();
-         si != this->RccSources.end(); ++si) {
-      const std::string ext =
-        cmsys::SystemTools::GetFilenameLastExtension(*si);
-      if (ext == ".qrc") {
-        qrcGenMap[*si] =
-          (this->TargetBuildSubDir + fpathUuid.get(*si, "qrc_", ".cpp"));
-      }
+  for (std::vector<std::string>::const_iterator si = this->RccSources.begin();
+       si != this->RccSources.end(); ++si) {
+    const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
+    if (ext == ".qrc") {
+      qrcGenMap[*si] = this->TargetBuildSubDir + fpathCheckSum.getPart(*si) +
+        "/qrc_" + cmsys::SystemTools::GetFilenameWithoutLastExtension(*si) +
+        ".cpp";
     }
   }
 
@@ -1368,15 +1367,11 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
                                      const std::string& qrcOutputFile,
                                      bool unique_n)
 {
-  std::string symbolName;
-  if (unique_n) {
-    symbolName =
-      cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
-  } else {
-    symbolName =
-      cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcOutputFile);
-    // Remove "qrc_" at string begin
-    symbolName.erase(0, 4);
+  std::string symbolName =
+    cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
+  if (!unique_n) {
+    symbolName += "_";
+    symbolName += fpathCheckSum.getPart(qrcInputFile);
   }
   // Replace '-' with '_'. The former is valid for
   // file names but not for symbol names.
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 466acb2..302c9be 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -4,6 +4,7 @@
 #define cmQtAutoGenerators_h
 
 #include <cmConfigure.h> // IWYU pragma: keep
+#include <cmFilePathChecksum.h>
 
 #include <list>
 #include <map>
@@ -130,6 +131,8 @@ private:
   std::map<std::string, std::string> RccOptions;
   std::map<std::string, std::vector<std::string> > RccInputs;
 
+  cmFilePathChecksum fpathCheckSum;
+
   bool IncludeProjectDirsBefore;
   bool Verbose;
   bool ColorOutput;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3afe4070b9c5ba08a11ce3b4b30d2c1ad4c591d
commit d3afe4070b9c5ba08a11ce3b4b30d2c1ad4c591d
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:56:50 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:59 2016 -0500

    QtAutogen: Remove .dir suffix from automoc build directory

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index a443934..e589a5a 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -79,7 +79,7 @@ static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
   std::string targetDir = makefile->GetCurrentBinaryDirectory();
   targetDir += "/";
   targetDir += GetAutogenTargetName(target);
-  targetDir += ".dir/";
+  targetDir += "/";
   return targetDir;
 }
 
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index e5d7b57..bd01d50 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -390,7 +390,7 @@ bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
 void cmQtAutoGenerators::Init()
 {
   this->TargetBuildSubDir = this->TargetName;
-  this->TargetBuildSubDir += ".dir/";
+  this->TargetBuildSubDir += "/";
 
   this->OutMocCppFilenameRel = this->TargetBuildSubDir;
   this->OutMocCppFilenameRel += "moc_compilation.cpp";

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f53b1ab642ca1e5977121ec60779f248cf8ee88
commit 6f53b1ab642ca1e5977121ec60779f248cf8ee88
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:51:00 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:59 2016 -0500

    QtAutogen: Generate moc compilation in _automoc.dir/moc_compilation.cpp

diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index 8143ba9..eea57e3 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -30,7 +30,7 @@ source files at build time and invoke moc accordingly.
   alternative extensions, such as ``hpp``, ``hxx`` etc when searching
   for headers.  The resulting moc files, which are not included as shown
   above in any of the source files are included in a generated
-  ``<targetname>_automoc.cpp`` file, which is compiled as part of the
+  ``moc_compilation.cpp`` file, which is compiled as part of the
   target.
 
 This property is initialized by the value of the :variable:`CMAKE_AUTOMOC`
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index de70d34..a443934 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -650,14 +650,10 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
 void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
   cmGeneratorTarget* target)
 {
-  cmMakefile* makefile = target->Target->GetMakefile();
-
   if (target->GetPropertyAsBool("AUTOMOC")) {
-    std::string automocTargetName = GetAutogenTargetName(target);
-    std::string mocCppFile = makefile->GetCurrentBinaryDirectory();
-    mocCppFile += "/";
-    mocCppFile += automocTargetName;
-    mocCppFile += ".cpp";
+    cmMakefile* makefile = target->Target->GetMakefile();
+    std::string mocCppFile = GetAutogenTargetBuildDir(target);
+    mocCppFile += "moc_compilation.cpp";
     makefile->GetOrCreateSource(mocCppFile, true);
     makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(),
                              false);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index f90f0d5..e5d7b57 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -392,8 +392,8 @@ void cmQtAutoGenerators::Init()
   this->TargetBuildSubDir = this->TargetName;
   this->TargetBuildSubDir += ".dir/";
 
-  this->OutMocCppFilenameRel = this->TargetName;
-  this->OutMocCppFilenameRel += ".cpp";
+  this->OutMocCppFilenameRel = this->TargetBuildSubDir;
+  this->OutMocCppFilenameRel += "moc_compilation.cpp";
 
   this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
 
@@ -480,10 +480,10 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
   // the program goes through all .cpp files to see which moc files are
   // included. It is not really interesting how the moc file is named, but
   // what file the moc is created from. Once a moc is included the same moc
-  // may not be included in the _automoc.cpp file anymore. OTOH if there's a
-  // header containing Q_OBJECT where no corresponding moc file is included
-  // anywhere a moc_<filename>.cpp file is created and included in
-  // the _automoc.cpp file.
+  // may not be included in the moc_compilation.cpp file anymore. OTOH if
+  // there's a header containing Q_OBJECT where no corresponding moc file
+  // is included anywhere a moc_<filename>.cpp file is created and included in
+  // the moc_compilation.cpp file.
 
   // key = moc source filepath, value = moc output filepath
   std::map<std::string, std::string> includedMocs;
@@ -1041,30 +1041,34 @@ bool cmQtAutoGenerators::GenerateMocFiles(
     }
   }
 
-  // compose _automoc.cpp content
+  // Compose moc_compilation.cpp content
   std::string automocSource;
   {
     std::ostringstream outStream;
     outStream << "/* This file is autogenerated, do not edit*/\n";
     if (notIncludedMocs.empty()) {
+      // Dummy content
       outStream << "enum some_compilers { need_more_than_nothing };\n";
     } else {
+      // Includes content
       for (std::map<std::string, std::string>::const_iterator it =
              notIncludedMocs.begin();
            it != notIncludedMocs.end(); ++it) {
-        outStream << "#include \"" << it->second << "\"\n";
+        outStream << "#include \""
+                  << it->second.substr(this->TargetBuildSubDir.size())
+                  << "\"\n";
       }
     }
     outStream.flush();
     automocSource = outStream.str();
   }
 
-  // check if we even need to update _automoc.cpp
+  // Check if we even need to update moc_compilation.cpp
   if (!automocCppChanged) {
-    // compare contents of the _automoc.cpp file
+    // compare contents of the moc_compilation.cpp file
     const std::string oldContents = ReadAll(this->OutMocCppFilenameAbs);
     if (oldContents == automocSource) {
-      // nothing changed: don't touch the _automoc.cpp file
+      // nothing changed: don't touch the moc_compilation.cpp file
       if (this->Verbose) {
         std::ostringstream err;
         err << "AUTOGEN: " << this->OutMocCppFilenameRel << " still up to date"
@@ -1075,7 +1079,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
     }
   }
 
-  // actually write _automoc.cpp
+  // Actually write moc_compilation.cpp
   {
     std::string msg = "Generating MOC compilation ";
     msg += this->OutMocCppFilenameRel;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=39e07d7a175d5da0c1a2ebc905689705571d2084
commit 39e07d7a175d5da0c1a2ebc905689705571d2084
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:12:50 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:59 2016 -0500

    QtAutogen: Use upper case for MOC, UIC and RCC in messages

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 76af466..de70d34 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -705,13 +705,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   {
     std::vector<std::string> toolNames;
     if (target->GetPropertyAsBool("AUTOMOC")) {
-      toolNames.push_back("moc");
+      toolNames.push_back("MOC");
     }
     if (target->GetPropertyAsBool("AUTOUIC")) {
-      toolNames.push_back("uic");
+      toolNames.push_back("UIC");
     }
     if (target->GetPropertyAsBool("AUTORCC")) {
-      toolNames.push_back("rcc");
+      toolNames.push_back("RCC");
     }
 
     std::string tools = toolNames[0];
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index b497fb0..f90f0d5 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1389,7 +1389,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
 
   if (this->GenerateAll || generateQrc) {
     {
-      std::string msg = "Generating QRC source ";
+      std::string msg = "Generating RCC source ";
       msg += qrcOutputFile;
       this->LogBold(msg);
     }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c6f990fb600d042ebb7a21996280ef31798bc79
commit 8c6f990fb600d042ebb7a21996280ef31798bc79
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:08:41 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:58 2016 -0500

    QtAutogen: New common bold logging method

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 23424c4..b497fb0 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1077,11 +1077,9 @@ bool cmQtAutoGenerators::GenerateMocFiles(
 
   // actually write _automoc.cpp
   {
-    std::string msg = "Generating moc compilation ";
+    std::string msg = "Generating MOC compilation ";
     msg += this->OutMocCppFilenameRel;
-    cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                       cmsysTerminal_Color_ForegroundBold,
-                                     msg.c_str(), true, this->ColorOutput);
+    this->LogBold(msg);
   }
   // Make sure the parent directory exists
   bool success = this->makeParentDirectory(this->OutMocCppFilenameAbs);
@@ -1119,11 +1117,9 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
                                                      &sourceNewerThanMoc);
   if (this->GenerateAll || !success || sourceNewerThanMoc >= 0) {
     {
-      std::string msg = "Generating moc source ";
+      std::string msg = "Generating MOC source ";
       msg += mocFileName;
-      cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                         cmsysTerminal_Color_ForegroundBold,
-                                       msg.c_str(), true, this->ColorOutput);
+      this->LogBold(msg);
     }
 
     // Make sure the parent directory exists
@@ -1245,11 +1241,9 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
                                                      &sourceNewerThanUi);
   if (this->GenerateAll || !success || sourceNewerThanUi >= 0) {
     {
-      std::string msg = "Generating ui header ";
+      std::string msg = "Generating UIC header ";
       msg += uiOutputFile;
-      cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                         cmsysTerminal_Color_ForegroundBold,
-                                       msg.c_str(), true, this->ColorOutput);
+      this->LogBold(msg);
     }
 
     // Make sure the parent directory exists
@@ -1395,11 +1389,9 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
 
   if (this->GenerateAll || generateQrc) {
     {
-      std::string msg = "Generating qrc source ";
+      std::string msg = "Generating QRC source ";
       msg += qrcOutputFile;
-      cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                         cmsysTerminal_Color_ForegroundBold,
-                                       msg.c_str(), true, this->ColorOutput);
+      this->LogBold(msg);
     }
 
     // Make sure the parent directory exists
@@ -1493,6 +1485,13 @@ void cmQtAutoGenerators::LogErrorNameCollision(
   this->LogError(err.str());
 }
 
+void cmQtAutoGenerators::LogBold(const std::string& message)
+{
+  cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
+                                     cmsysTerminal_Color_ForegroundBold,
+                                   message.c_str(), true, this->ColorOutput);
+}
+
 void cmQtAutoGenerators::LogInfo(const std::string& message)
 {
   std::cout << message.c_str();
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 7cba1ea..466acb2 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -80,6 +80,7 @@ private:
   void LogErrorNameCollision(
     const std::string& message,
     const std::multimap<std::string, std::string>& collisions);
+  void LogBold(const std::string& message);
   void LogInfo(const std::string& message);
   void LogWarning(const std::string& message);
   void LogError(const std::string& message);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49f8687e1601bacd3386d8393dc831124691715e
commit 49f8687e1601bacd3386d8393dc831124691715e
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:02:32 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:58 2016 -0500

    QtAutogen: Make sure parent directory exists before writing files

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index c6781de..23424c4 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -374,14 +374,13 @@ bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
   {
     cmsys::ofstream outfile;
     outfile.open(filename.c_str(), std::ios::trunc);
-    if (outfile.is_open()) {
+    success = outfile.is_open();
+    if (success) {
       outfile << "set(AM_OLD_COMPILE_SETTINGS "
               << cmOutputConverter::EscapeForCMake(
                    this->CurrentCompileSettingsStr)
               << ")\n";
       success = outfile.good();
-    } else {
-      success = false;
     }
   }
 
@@ -1084,14 +1083,28 @@ bool cmQtAutoGenerators::GenerateMocFiles(
                                        cmsysTerminal_Color_ForegroundBold,
                                      msg.c_str(), true, this->ColorOutput);
   }
-  {
+  // Make sure the parent directory exists
+  bool success = this->makeParentDirectory(this->OutMocCppFilenameAbs);
+  if (success) {
     cmsys::ofstream outfile;
     outfile.open(this->OutMocCppFilenameAbs.c_str(), std::ios::trunc);
-    outfile << automocSource;
-    outfile.close();
+    if (!outfile.is_open()) {
+      success = false;
+      std::ostringstream err;
+      err << "AUTOGEN: error opening " << this->OutMocCppFilenameAbs << "\n";
+      this->LogError(err.str());
+    } else {
+      outfile << automocSource;
+      // Check for write errors
+      if (!outfile.good()) {
+        success = false;
+        std::ostringstream err;
+        err << "AUTOGEN: error writing " << this->OutMocCppFilenameAbs << "\n";
+        this->LogError(err.str());
+      }
+    }
   }
-
-  return true;
+  return success;
 }
 
 /**
@@ -1105,17 +1118,19 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
   bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFilePath,
                                                      &sourceNewerThanMoc);
   if (this->GenerateAll || !success || sourceNewerThanMoc >= 0) {
-    // make sure the directory for the resulting moc file exists
-    std::string mocDir = mocFilePath.substr(0, mocFilePath.rfind('/'));
-    if (!cmsys::SystemTools::FileExists(mocDir.c_str(), false)) {
-      cmsys::SystemTools::MakeDirectory(mocDir.c_str());
+    {
+      std::string msg = "Generating moc source ";
+      msg += mocFileName;
+      cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
+                                         cmsysTerminal_Color_ForegroundBold,
+                                       msg.c_str(), true, this->ColorOutput);
     }
 
-    std::string msg = "Generating moc source ";
-    msg += mocFileName;
-    cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                       cmsysTerminal_Color_ForegroundBold,
-                                     msg.c_str(), true, this->ColorOutput);
+    // Make sure the parent directory exists
+    if (!this->makeParentDirectory(mocFilePath)) {
+      this->RunMocFailed = true;
+      return false;
+    }
 
     std::vector<std::string> command;
     command.push_back(this->MocExecutable);
@@ -1223,21 +1238,25 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
                                     const std::string& uiInputFile,
                                     const std::string& uiOutputFile)
 {
-  if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false)) {
-    cmsys::SystemTools::MakeDirectory(this->Builddir.c_str());
-  }
-
   const std::string uiBuildFile = this->Builddir + uiOutputFile;
 
   int sourceNewerThanUi = 0;
   bool success = cmsys::SystemTools::FileTimeCompare(uiInputFile, uiBuildFile,
                                                      &sourceNewerThanUi);
   if (this->GenerateAll || !success || sourceNewerThanUi >= 0) {
-    std::string msg = "Generating ui header ";
-    msg += uiOutputFile;
-    cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                       cmsysTerminal_Color_ForegroundBold,
-                                     msg.c_str(), true, this->ColorOutput);
+    {
+      std::string msg = "Generating ui header ";
+      msg += uiOutputFile;
+      cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
+                                         cmsysTerminal_Color_ForegroundBold,
+                                       msg.c_str(), true, this->ColorOutput);
+    }
+
+    // Make sure the parent directory exists
+    if (!this->makeParentDirectory(uiBuildFile)) {
+      this->RunUicFailed = true;
+      return false;
+    }
 
     std::vector<std::string> command;
     command.push_back(this->UicExecutable);
@@ -1375,21 +1394,29 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
     generateQrc || this->InputFilesNewerThanQrc(qrcInputFile, qrcBuildFile);
 
   if (this->GenerateAll || generateQrc) {
-    std::string msg = "Generating qrc source ";
-    msg += qrcOutputFile;
-    cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
-                                       cmsysTerminal_Color_ForegroundBold,
-                                     msg.c_str(), true, this->ColorOutput);
+    {
+      std::string msg = "Generating qrc source ";
+      msg += qrcOutputFile;
+      cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |
+                                         cmsysTerminal_Color_ForegroundBold,
+                                       msg.c_str(), true, this->ColorOutput);
+    }
+
+    // Make sure the parent directory exists
+    if (!this->makeParentDirectory(qrcOutputFile)) {
+      this->RunRccFailed = true;
+      return false;
+    }
 
     std::vector<std::string> command;
     command.push_back(this->RccExecutable);
-
-    std::map<std::string, std::string>::const_iterator optionIt =
-      this->RccOptions.find(qrcInputFile);
-    if (optionIt != this->RccOptions.end()) {
-      cmSystemTools::ExpandListArgument(optionIt->second, command);
+    {
+      std::map<std::string, std::string>::const_iterator optionIt =
+        this->RccOptions.find(qrcInputFile);
+      if (optionIt != this->RccOptions.end()) {
+        cmSystemTools::ExpandListArgument(optionIt->second, command);
+      }
     }
-
     command.push_back("-name");
     command.push_back(symbolName);
     command.push_back("-o");
@@ -1501,6 +1528,25 @@ void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
   }
 }
 
+/**
+ * @brief Generates the parent directory of the given file on demand
+ * @return True on success
+ */
+bool cmQtAutoGenerators::makeParentDirectory(const std::string& filename)
+{
+  bool success = true;
+  const std::string dirName = cmSystemTools::GetFilenamePath(filename);
+  if (!dirName.empty()) {
+    success = cmsys::SystemTools::MakeDirectory(dirName);
+    if (!success) {
+      std::ostringstream err;
+      err << "AUTOGEN: Directory creation failed: " << dirName << std::endl;
+      this->LogError(err.str());
+    }
+  }
+  return success;
+}
+
 std::string cmQtAutoGenerators::JoinExts(const std::vector<std::string>& lst)
 {
   if (lst.empty()) {
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 99b1fbf..7cba1ea 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -85,6 +85,8 @@ private:
   void LogError(const std::string& message);
   void LogCommand(const std::vector<std::string>& command);
 
+  bool makeParentDirectory(const std::string& filename);
+
   std::string JoinExts(const std::vector<std::string>& lst);
 
   static void MergeUicOptions(std::vector<std::string>& opts,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7731121d66dc2212c67eb9d49840ac846bd00ce7
commit 7731121d66dc2212c67eb9d49840ac846bd00ce7
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 21:17:38 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:58 2016 -0500

    QtAutogen: Improved error handling

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a6099fa..c6781de 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -515,10 +515,15 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
       this->LogInfo(err.str());
     }
     if (this->MocRelaxedMode) {
-      this->ParseCppFile(absFilename, headerExtensions, includedMocs, uiFiles);
+      if (!this->ParseCppFile(absFilename, headerExtensions, includedMocs,
+                              uiFiles)) {
+        return false;
+      }
     } else {
-      this->StrictParseCppFile(absFilename, headerExtensions, includedMocs,
-                               uiFiles);
+      if (!this->StrictParseCppFile(absFilename, headerExtensions,
+                                    includedMocs, uiFiles)) {
+        return false;
+      }
     }
     this->SearchHeadersForCppFile(absFilename, headerExtensions, headerFiles);
   }
@@ -568,7 +573,10 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
   return true;
 }
 
-void cmQtAutoGenerators::ParseCppFile(
+/**
+ * @return True on success
+ */
+bool cmQtAutoGenerators::ParseCppFile(
   const std::string& absFilename,
   const std::vector<std::string>& headerExtensions,
   std::map<std::string, std::string>& includedMocs,
@@ -584,11 +592,11 @@ void cmQtAutoGenerators::ParseCppFile(
     err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
         << std::endl;
     this->LogWarning(err.str());
-    return;
+    return true;
   }
   this->ParseForUic(absFilename, contentsString, includedUis);
   if (this->MocExecutable.empty()) {
-    return;
+    return true;
   }
 
   const std::string absPath = cmsys::SystemTools::GetFilenamePath(
@@ -652,7 +660,7 @@ void cmQtAutoGenerators::ParseCppFile(
                 << std::endl;
           }
           this->LogError(err.str());
-          ::exit(EXIT_FAILURE);
+          return false;
         }
       } else {
         std::string fileToMoc = absFilename;
@@ -700,7 +708,7 @@ void cmQtAutoGenerators::ParseCppFile(
                    "header.\n"
                 << std::endl;
             this->LogError(err.str());
-            ::exit(EXIT_FAILURE);
+            return false;
           }
         } else {
           dotMocIncluded = true;
@@ -744,13 +752,17 @@ void cmQtAutoGenerators::ParseCppFile(
           << "\"" << scannedFileBasename << ".moc\" !\n"
           << std::endl;
       this->LogError(err.str());
-
-      ::exit(EXIT_FAILURE);
+      return false;
     }
   }
+
+  return true;
 }
 
-void cmQtAutoGenerators::StrictParseCppFile(
+/**
+ * @return True on success
+ */
+bool cmQtAutoGenerators::StrictParseCppFile(
   const std::string& absFilename,
   const std::vector<std::string>& headerExtensions,
   std::map<std::string, std::string>& includedMocs,
@@ -766,11 +778,11 @@ void cmQtAutoGenerators::StrictParseCppFile(
     err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
         << std::endl;
     this->LogWarning(err.str());
-    return;
+    return true;
   }
   this->ParseForUic(absFilename, contentsString, includedUis);
   if (this->MocExecutable.empty()) {
-    return;
+    return true;
   }
 
   const std::string absPath = cmsys::SystemTools::GetFilenamePath(
@@ -823,7 +835,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
                 << std::endl;
           }
           this->LogError(err.str());
-          ::exit(EXIT_FAILURE);
+          return false;
         }
       } else {
         if (basename != scannedFileBasename) {
@@ -839,7 +851,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
                                         "moc on this source file.\n"
               << std::endl;
           this->LogError(err.str());
-          ::exit(EXIT_FAILURE);
+          return false;
         }
         dotMocIncluded = true;
         includedMocs[absFilename] = currentMoc;
@@ -861,8 +873,10 @@ void cmQtAutoGenerators::StrictParseCppFile(
         << "\"" << scannedFileBasename << ".moc\" !\n"
         << std::endl;
     this->LogError(err.str());
-    ::exit(EXIT_FAILURE);
+    return false;
   }
+
+  return true;
 }
 
 void cmQtAutoGenerators::ParseForUic(
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 816c380..99b1fbf 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -43,12 +43,12 @@ private:
   bool GenerateQrc(const std::string& qrcInputFile,
                    const std::string& qrcOutputFile, bool unique_n);
 
-  void ParseCppFile(
+  bool ParseCppFile(
     const std::string& absFilename,
     const std::vector<std::string>& headerExtensions,
     std::map<std::string, std::string>& includedMocs,
     std::map<std::string, std::vector<std::string> >& includedUis);
-  void StrictParseCppFile(
+  bool StrictParseCppFile(
     const std::string& absFilename,
     const std::vector<std::string>& headerExtensions,
     std::map<std::string, std::string>& includedMocs,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3
commit 00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 21:08:54 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:58 2016 -0500

    QtAutogen: Error and warning log method tweaks

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a0302cb..a6099fa 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -8,6 +8,7 @@
 #include <cmsys/FStream.hxx>
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/Terminal.h>
+#include <iostream>
 #include <sstream>
 #include <stdlib.h>
 #include <string.h>
@@ -195,7 +196,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
 
   if (!makefile->ReadListFile(filename.c_str())) {
     std::ostringstream err;
-    err << "AUTOGEN: Error processing file: " << filename << std::endl;
+    err << "AUTOGEN: error processing file: " << filename << std::endl;
     this->LogError(err.str());
     return false;
   }
@@ -582,7 +583,7 @@ void cmQtAutoGenerators::ParseCppFile(
     std::ostringstream err;
     err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
         << std::endl;
-    this->LogError(err.str());
+    this->LogWarning(err.str());
     return;
   }
   this->ParseForUic(absFilename, contentsString, includedUis);
@@ -673,7 +674,7 @@ void cmQtAutoGenerators::ParseCppFile(
                   << ".cpp\" for a compatibility with "
                      "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"
                   << std::endl;
-              this->LogError(err.str());
+              this->LogWarning(err.str());
             } else {
               std::ostringstream err;
               err << "AUTOGEN: warning: " << absFilename
@@ -686,7 +687,7 @@ void cmQtAutoGenerators::ParseCppFile(
                   << ".cpp\" for compatibility with "
                      "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"
                   << std::endl;
-              this->LogError(err.str());
+              this->LogWarning(err.str());
             }
           } else {
             std::ostringstream err;
@@ -730,7 +731,7 @@ void cmQtAutoGenerators::ParseCppFile(
           << ".moc\" for compatibility with "
              "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"
           << std::endl;
-      this->LogError(err.str());
+      this->LogWarning(err.str());
 
       includedMocs[absFilename] = ownMocUnderscoreFile;
       includedMocs.erase(ownMocHeaderFile);
@@ -764,7 +765,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
     std::ostringstream err;
     err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
         << std::endl;
-    this->LogError(err.str());
+    this->LogWarning(err.str());
     return;
   }
   this->ParseForUic(absFilename, contentsString, includedUis);
@@ -876,7 +877,7 @@ void cmQtAutoGenerators::ParseForUic(
     std::ostringstream err;
     err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
         << std::endl;
-    this->LogError(err.str());
+    this->LogWarning(err.str());
     return;
   }
   this->ParseForUic(absFilename, contentsString, includedUis);
@@ -997,7 +998,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
           << "To avoid this error either" << std::endl
           << "- rename the source files or" << std::endl
           << "- do not include the (moc_NAME.cpp|NAME.moc) file" << std::endl;
-      this->NameCollisionLog(err.str(), collisions);
+      this->LogErrorNameCollision(err.str(), collisions);
       return false;
     }
   }
@@ -1176,7 +1177,7 @@ bool cmQtAutoGenerators::GenerateUiFiles(
              "from different sources."
           << std::endl
           << "To avoid this error rename the source files." << std::endl;
-      this->NameCollisionLog(err.str(), collisions);
+      this->LogErrorNameCollision(err.str(), collisions);
       return false;
     }
   }
@@ -1310,7 +1311,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
              " will be generated from different sources."
           << std::endl
           << "To avoid this error rename the source .qrc files." << std::endl;
-      this->NameCollisionLog(err.str(), collisions);
+      this->LogErrorNameCollision(err.str(), collisions);
       return false;
     }
   }
@@ -1435,7 +1436,7 @@ bool cmQtAutoGenerators::NameCollisionTest(
   return !collisions.empty();
 }
 
-void cmQtAutoGenerators::NameCollisionLog(
+void cmQtAutoGenerators::LogErrorNameCollision(
   const std::string& message,
   const std::multimap<std::string, std::string>& collisions)
 {
@@ -1453,12 +1454,21 @@ void cmQtAutoGenerators::NameCollisionLog(
 
 void cmQtAutoGenerators::LogInfo(const std::string& message)
 {
-  cmSystemTools::Message(message.c_str());
+  std::cout << message.c_str();
+}
+
+void cmQtAutoGenerators::LogWarning(const std::string& message)
+{
+  std::ostringstream ostr;
+  ostr << message << "\n";
+  std::cout << message.c_str();
 }
 
 void cmQtAutoGenerators::LogError(const std::string& message)
 {
-  cmSystemTools::Error(message.c_str());
+  std::ostringstream ostr;
+  ostr << message << "\n\n";
+  std::cerr << ostr.str();
 }
 
 void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 47f3289..816c380 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -76,13 +76,15 @@ private:
 
   bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
                          std::multimap<std::string, std::string>& collisions);
-  void NameCollisionLog(
+
+  void LogErrorNameCollision(
     const std::string& message,
     const std::multimap<std::string, std::string>& collisions);
-
   void LogInfo(const std::string& message);
+  void LogWarning(const std::string& message);
   void LogError(const std::string& message);
   void LogCommand(const std::vector<std::string>& command);
+
   std::string JoinExts(const std::vector<std::string>& lst);
 
   static void MergeUicOptions(std::vector<std::string>& opts,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=708e44af5d445d25cc39e83da800ccc57f90a79a
commit 708e44af5d445d25cc39e83da800ccc57f90a79a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 20:47:54 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:57 2016 -0500

    QtAutogen: Improved error recognition

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index eea9804..a0302cb 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -549,32 +549,19 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
   this->ParseHeaders(headerFiles, includedMocs, notIncludedMocs, includedUis);
 
   if (!this->MocExecutable.empty()) {
-    this->GenerateMocFiles(includedMocs, notIncludedMocs);
+    if (!this->GenerateMocFiles(includedMocs, notIncludedMocs)) {
+      return false;
+    }
   }
   if (!this->UicExecutable.empty()) {
-    this->GenerateUiFiles(includedUis);
+    if (!this->GenerateUiFiles(includedUis)) {
+      return false;
+    }
   }
   if (!this->RccExecutable.empty()) {
-    this->GenerateQrcFiles();
-  }
-
-  if (this->RunMocFailed) {
-    std::ostringstream err;
-    err << "moc failed..." << std::endl;
-    this->LogError(err.str());
-    return false;
-  }
-  if (this->RunUicFailed) {
-    std::ostringstream err;
-    err << "uic failed..." << std::endl;
-    this->LogError(err.str());
-    return false;
-  }
-  if (this->RunRccFailed) {
-    std::ostringstream err;
-    err << "rcc failed..." << std::endl;
-    this->LogError(err.str());
-    return false;
+    if (!this->GenerateQrcFiles()) {
+      return false;
+    }
   }
 
   return true;
@@ -1011,7 +998,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
           << "- rename the source files or" << std::endl
           << "- do not include the (moc_NAME.cpp|NAME.moc) file" << std::endl;
       this->NameCollisionLog(err.str(), collisions);
-      ::exit(EXIT_FAILURE);
+      return false;
     }
   }
 
@@ -1092,6 +1079,9 @@ bool cmQtAutoGenerators::GenerateMocFiles(
   return true;
 }
 
+/**
+ * @return True if a moc file was created. False may indicate an error.
+ */
 bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
                                      const std::string& mocFileName)
 {
@@ -1136,12 +1126,16 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
     bool result =
       cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
     if (!result || retVal) {
-      std::ostringstream err;
-      err << "AUTOGEN: error: process for " << mocFilePath << " failed:\n"
-          << output << std::endl;
-      this->LogError(err.str());
-      this->RunMocFailed = true;
+      {
+        std::ostringstream err;
+        err << "AUTOGEN: error: moc process for " << mocFilePath
+            << " failed:\n"
+            << output << std::endl;
+        this->LogError(err.str());
+      }
       cmSystemTools::RemoveFile(mocFilePath);
+      this->RunMocFailed = true;
+      return false;
     }
     return true;
   }
@@ -1183,7 +1177,7 @@ bool cmQtAutoGenerators::GenerateUiFiles(
           << std::endl
           << "To avoid this error rename the source files." << std::endl;
       this->NameCollisionLog(err.str(), collisions);
-      ::exit(EXIT_FAILURE);
+      return false;
     }
   }
   testMap.clear();
@@ -1207,6 +1201,9 @@ bool cmQtAutoGenerators::GenerateUiFiles(
   return true;
 }
 
+/**
+ * @return True if a uic file was created. False may indicate an error.
+ */
 bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
                                     const std::string& uiInputFile,
                                     const std::string& uiOutputFile)
@@ -1253,13 +1250,15 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
     bool result =
       cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
     if (!result || retVal) {
-      std::ostringstream err;
-      err << "AUTOUIC: error: process for " << uiOutputFile
-          << " needed by\n \"" << realName << "\"\nfailed:\n"
-          << output << std::endl;
-      this->LogError(err.str());
-      this->RunUicFailed = true;
+      {
+        std::ostringstream err;
+        err << "AUTOUIC: error: uic process for " << uiOutputFile
+            << " needed by\n \"" << realName << "\"\nfailed:\n"
+            << output << std::endl;
+        this->LogError(err.str());
+      }
       cmSystemTools::RemoveFile(uiOutputFile);
+      this->RunUicFailed = true;
       return false;
     }
     return true;
@@ -1312,7 +1311,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
           << std::endl
           << "To avoid this error rename the source .qrc files." << std::endl;
       this->NameCollisionLog(err.str(), collisions);
-      ::exit(EXIT_FAILURE);
+      return false;
     }
   }
 
@@ -1330,6 +1329,9 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
   return true;
 }
 
+/**
+ * @return True if a rcc file was created. False may indicate an error.
+ */
 bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
                                      const std::string& qrcOutputFile,
                                      bool unique_n)
@@ -1387,16 +1389,20 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
     bool result =
       cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
     if (!result || retVal) {
-      std::ostringstream err;
-      err << "AUTORCC: error: process for " << qrcOutputFile << " failed:\n"
-          << output << std::endl;
-      this->LogError(err.str());
-      this->RunRccFailed = true;
+      {
+        std::ostringstream err;
+        err << "AUTORCC: error: rcc process for " << qrcOutputFile
+            << " failed:\n"
+            << output << std::endl;
+        this->LogError(err.str());
+      }
       cmSystemTools::RemoveFile(qrcBuildFile);
+      this->RunRccFailed = true;
       return false;
     }
+    return true;
   }
-  return true;
+  return false;
 }
 
 /**

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c97d1df20bbf771568321020e84718b82788272
commit 1c97d1df20bbf771568321020e84718b82788272
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 20:31:22 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:23:52 2016 -0500

    QtAutogen: Improved error recognition on config load

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index c0a9b63..eea9804 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -8,7 +8,6 @@
 #include <cmsys/FStream.hxx>
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/Terminal.h>
-#include <iostream>
 #include <sstream>
 #include <stdlib.h>
 #include <string.h>
@@ -159,7 +158,6 @@ void cmQtAutoGenerators::MergeUicOptions(
 bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
                              const std::string& config)
 {
-  bool success = true;
   cmake cm;
   cm.SetHomeOutputDirectory(targetDirectory);
   cm.SetHomeDirectory(targetDirectory);
@@ -173,18 +171,18 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
   CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, snapshot));
   gg.SetCurrentMakefile(mf.get());
 
-  this->ReadAutogenInfoFile(mf.get(), targetDirectory, config);
+  if (!this->ReadAutogenInfoFile(mf.get(), targetDirectory, config)) {
+    return false;
+  }
   this->ReadOldMocDefinitionsFile(mf.get(), targetDirectory);
-
   this->Init();
 
   if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5") {
-    success = this->RunAutogen(mf.get());
+    if (!this->RunAutogen(mf.get())) {
+      return false;
+    }
   }
-
-  this->WriteOldMocDefinitionsFile(targetDirectory);
-
-  return success;
+  return this->WriteOldMocDefinitionsFile(targetDirectory);
 }
 
 bool cmQtAutoGenerators::ReadAutogenInfoFile(
@@ -196,7 +194,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   filename += "/AutogenInfo.cmake";
 
   if (!makefile->ReadListFile(filename.c_str())) {
-    cmSystemTools::Error("Error processing file: ", filename.c_str());
+    std::ostringstream err;
+    err << "AUTOGEN: Error processing file: " << filename << std::endl;
+    this->LogError(err.str());
     return false;
   }
 
@@ -303,8 +303,15 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
     std::vector<std::string> rccInputLists;
     cmSystemTools::ExpandListArgument(rccInputs, rccInputLists);
 
+    // qrc files in the end of the list may have been empty
+    if (rccInputLists.size() < this->RccSources.size()) {
+      rccInputLists.resize(this->RccSources.size());
+    }
     if (this->RccSources.size() != rccInputLists.size()) {
-      cmSystemTools::Error("Error processing file: ", filename.c_str());
+      std::ostringstream err;
+      err << "AUTOGEN: RCC sources lists size missmatch in: " << filename;
+      err << std::endl;
+      this->LogError(err.str());
       return false;
     }
 
@@ -341,7 +348,7 @@ std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile)
   return s;
 }
 
-bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(
+void cmQtAutoGenerators::ReadOldMocDefinitionsFile(
   cmMakefile* makefile, const std::string& targetDirectory)
 {
   std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
@@ -352,23 +359,32 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(
     this->OldCompileSettingsStr =
       makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS");
   }
-  return true;
 }
 
-void cmQtAutoGenerators::WriteOldMocDefinitionsFile(
+bool cmQtAutoGenerators::WriteOldMocDefinitionsFile(
   const std::string& targetDirectory)
 {
+  bool success = true;
+
   std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
   cmSystemTools::ConvertToUnixSlashes(filename);
   filename += "/AutomocOldMocDefinitions.cmake";
 
-  cmsys::ofstream outfile;
-  outfile.open(filename.c_str(), std::ios::trunc);
-  outfile << "set(AM_OLD_COMPILE_SETTINGS "
-          << cmOutputConverter::EscapeForCMake(this->CurrentCompileSettingsStr)
-          << ")\n";
+  {
+    cmsys::ofstream outfile;
+    outfile.open(filename.c_str(), std::ios::trunc);
+    if (outfile.is_open()) {
+      outfile << "set(AM_OLD_COMPILE_SETTINGS "
+              << cmOutputConverter::EscapeForCMake(
+                   this->CurrentCompileSettingsStr)
+              << ")\n";
+      success = outfile.good();
+    } else {
+      success = false;
+    }
+  }
 
-  outfile.close();
+  return success;
 }
 
 void cmQtAutoGenerators::Init()
@@ -1431,12 +1447,12 @@ void cmQtAutoGenerators::NameCollisionLog(
 
 void cmQtAutoGenerators::LogInfo(const std::string& message)
 {
-  std::cout << message;
+  cmSystemTools::Message(message.c_str());
 }
 
 void cmQtAutoGenerators::LogError(const std::string& message)
 {
-  std::cerr << message;
+  cmSystemTools::Error(message.c_str());
 }
 
 void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index b26b307..47f3289 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -23,9 +23,9 @@ private:
   bool ReadAutogenInfoFile(cmMakefile* makefile,
                            const std::string& targetDirectory,
                            const std::string& config);
-  bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
+  void ReadOldMocDefinitionsFile(cmMakefile* makefile,
                                  const std::string& targetDirectory);
-  void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
+  bool WriteOldMocDefinitionsFile(const std::string& targetDirectory);
 
   std::string MakeCompileSettingsString(cmMakefile* makefile);
 

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list