[Cmake-commits] CMake branch, next, updated. v3.7.1-1588-gaa1fb2f
Brad King
brad.king at kitware.com
Tue Dec 6 13:00:53 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 aa1fb2f40605bb2cc359a04875126cb1c274ee63 (commit)
via 581a2808db8d2df705b57d99bd4f023499a2a564 (commit)
via 6b6df66568567851dca227c6892d5774fd0198cf (commit)
via 37ac89d01093efaaec26ddba6a1452d70ad3efca (commit)
via 07488d68e7e23a6ebd7ecf6f56afd946577b424e (commit)
via f2305cd6ec1da6060e866c3d7fd82e09fdb6beb6 (commit)
via 9508a3ad5d7c85e1e0e2f984144badc5c9d3410e (commit)
via bfa853191d45137d73337063366dda963defcd2b (commit)
via fa29a5ef43f35f411bac78786a98e214e82bd188 (commit)
via 402d16512adb6d4cd7926bc8c3426a5a5b3d5c3d (commit)
via d77a0bcc65f1056543c780923ea3e7cb8984911a (commit)
via 09595bf87be18dedadf9ffcabfd230f835c36466 (commit)
via de51425e8e78a56dcb0a8737c301171b494a6118 (commit)
via 3566a76f8fd67e1f1e2f6807aa5c9ed5262b8d37 (commit)
via a84c119dcda402fdee1046330d9bf3785cdb8e62 (commit)
via d2982298ba8821b53bc8c278d55a27aefc64043d (commit)
via 1e82c51485f745d4659f3f731134e62a43249381 (commit)
via 66f6eb6bc62b5d89c7440d896243a89edc167a2b (commit)
via 58d36c8041dc2e2e2932b570b5e4d658f1a25ebc (commit)
via 88d2cd0c798ca2c1eb2070520879731518db906c (commit)
via a75211647fa4acf4c1c847958fc9ff7d05351d84 (commit)
via a24901c82eeef253079aefa4d2a6f86bc8ba80b6 (commit)
via fda1290d0a06cff77af86b6e6d81677ca7ce82e0 (commit)
via 9d0ef0ea14f76ca4b58db0bdcecdc2250d9a35a7 (commit)
via 7201cc232e32a4aa9b9825c0ded5b4fcefbd4106 (commit)
via bfeaa0d02ebf9ea44b03f378729728e95965308a (commit)
via 2c556b40f22295f2bcf69ec979f5f467bbe17387 (commit)
via 38cd817b719dcc6fd1750e1863ae6ac7fb923faa (commit)
via ba973d446764631b14c369f9ddc773e27ccfb12f (commit)
via ddfd827c449a8ded9043dbf700950202e0d2ae2a (commit)
via 6e8ac679a9a647101654da5b490f2b30a93f5f60 (commit)
via 69871e67e3b0612d7df8cc3ecf4a631850935e48 (commit)
via 9360e288168b850223285d1fbd695abd33cf26eb (commit)
via 8548caa3ee9914f7bd25dba4dadbb1c3a6338253 (commit)
via 9d9c68e21a09646816232fa849536ceaca106fc5 (commit)
via bb8c96689fe692196e8f77df6d071656b161b47c (commit)
via 48180401d321e7fba19ac45e9e2e8a718c20d0b8 (commit)
via 4fa858ecb1b40e63c733047f07cc5049f7e2366a (commit)
via 273e481e48c855905bde4d91a986c06713df0183 (commit)
via 6f024008ce2bdf11bec1ff1174ee68f9a6da6fcb (commit)
via ff1a01b743dc70e555fb0fc61eb4d019eb25df76 (commit)
via f448364de8cd2cd97933020fe0607d2fef3e1bcd (commit)
via 4eadf2ce3f90431fa3ae8a791fde432c6c60b5a1 (commit)
via 2e18801a1bf4e313fc2ec25d9a8842312728e1be (commit)
via 048aac2cf99061c5fc13a67fb707b064db5c8660 (commit)
via c9e220827810d693eefc7a2053bdb7b7de09ccf0 (commit)
via 26505dfcb7afd993d0e0622c0904d355f9b2da3f (commit)
via fc055c04e1ebab4b3e1f8209f8e4697ccee5a58f (commit)
via 9eba41479bc9f60cd810fa1786cb3baf3d570266 (commit)
via 693d85f8d62d63ddf860637c69b8b239e7f22ad8 (commit)
via 43747ee8b345481d3f669e3df68010dabc15d014 (commit)
via 8de8d3b191b020c499fdfdd8df237af95da946cd (commit)
via d0283dc1859d61dc2cbdec0c8ee0b00214976c06 (commit)
via 2c9667e897f0342c40afa5db5947d87f89e557b1 (commit)
from 637c24bf527c7cf0ffc753a8fbe858e6b9a6fb35 (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=aa1fb2f40605bb2cc359a04875126cb1c274ee63
commit aa1fb2f40605bb2cc359a04875126cb1c274ee63
Merge: 637c24b 581a280
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 13:00:49 2016 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Dec 6 13:00:49 2016 -0500
Merge topic 'QtAutogen_Contain' into next
581a2808 QtAutogen: Release notes for the Contain branch
6b6df665 QtAutogen: CMake-Qt documentation update
37ac89d0 QtAutogen: AUTOMOC documentation update
07488d68 QtAutogen: Tests: Don't use std::auto_ptr
f2305cd6 QtAutogen: Tests: Update ui_ include lookup directory
9508a3ad QtAutogen: Tests: Increase minimum required CMake version
bfa85319 QtAutogen: Tests: Don't use std::auto_ptr
fa29a5ef QtAutogen: Tests: Don't include CMAKE_CURRENT_BINARY_DIR
402d1651 QtAutogen: Don't use std::i/ofstream::is_open()
d77a0bcc QtAutogen: Rename and sort variables
09595bf8 QtAutogen: Generate rcc output file names in one place only
de51425e QtAutogen: Add rcc output files to autogen target byproducts
3566a76f QtAutogen: Add moc compilation file to autogen target byproducts
a84c119d QtAutogen: Reconfigure when .qrc file changes
d2982298 QtAutogen: Rename autogen target to *_autogen from *_automoc
1e82c514 QtAutogen: Inline single use variable definitions
...
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=581a2808db8d2df705b57d99bd4f023499a2a564
commit 581a2808db8d2df705b57d99bd4f023499a2a564
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 22:53:00 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:08 2016 +0100
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=6b6df66568567851dca227c6892d5774fd0198cf
commit 6b6df66568567851dca227c6892d5774fd0198cf
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon Dec 5 18:25:30 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:08 2016 +0100
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=37ac89d01093efaaec26ddba6a1452d70ad3efca
commit 37ac89d01093efaaec26ddba6a1452d70ad3efca
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 22:22:50 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:08 2016 +0100
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=07488d68e7e23a6ebd7ecf6f56afd946577b424e
commit 07488d68e7e23a6ebd7ecf6f56afd946577b424e
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Dec 6 16:46:16 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:08 2016 +0100
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=f2305cd6ec1da6060e866c3d7fd82e09fdb6beb6
commit f2305cd6ec1da6060e866c3d7fd82e09fdb6beb6
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Dec 6 16:42:24 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:08 2016 +0100
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=9508a3ad5d7c85e1e0e2f984144badc5c9d3410e
commit 9508a3ad5d7c85e1e0e2f984144badc5c9d3410e
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon Dec 5 18:44:13 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:08 2016 +0100
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=bfa853191d45137d73337063366dda963defcd2b
commit bfa853191d45137d73337063366dda963defcd2b
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:51:15 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:07 2016 +0100
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=fa29a5ef43f35f411bac78786a98e214e82bd188
commit fa29a5ef43f35f411bac78786a98e214e82bd188
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:34:37 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:07 2016 +0100
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=402d16512adb6d4cd7926bc8c3426a5a5b3d5c3d
commit 402d16512adb6d4cd7926bc8c3426a5a5b3d5c3d
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Tue Dec 6 17:33:10 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 17:35:07 2016 +0100
QtAutogen: Don't use std::i/ofstream::is_open()
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 6aebd9b..da5811c 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -394,13 +394,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;
}
}
@@ -1120,7 +1121,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=d77a0bcc65f1056543c780923ea3e7cb8984911a
commit d77a0bcc65f1056543c780923ea3e7cb8984911a
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Sun Dec 4 11:38:31 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 16:48:33 2016 +0100
QtAutogen: Rename and sort variables
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 3d48b03..6aebd9b 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -204,26 +204,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;
@@ -248,12 +257,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");
@@ -284,6 +290,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");
@@ -329,8 +341,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;
@@ -392,16 +409,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);
@@ -1129,8 +1147,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);
@@ -1250,8 +1268,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,
@@ -1332,7 +1350,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";
}
@@ -1383,7 +1401,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=09595bf87be18dedadf9ffcabfd230f835c36466
commit 09595bf87be18dedadf9ffcabfd230f835c36466
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 17:39:59 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 16:48:33 2016 +0100
QtAutogen: Generate rcc output file names in one place only
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index f7bd3c1..70f92d8 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(
@@ -782,12 +751,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=de51425e8e78a56dcb0a8737c301171b494a6118
commit de51425e8e78a56dcb0a8737c301171b494a6118
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 17:21:40 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 16:48:33 2016 +0100
QtAutogen: Add rcc output files to autogen target byproducts
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 9029751..f7bd3c1 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);
@@ -696,7 +696,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
@@ -769,35 +769,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=3566a76f8fd67e1f1e2f6807aa5c9ed5262b8d37
commit 3566a76f8fd67e1f1e2f6807aa5c9ed5262b8d37
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 17:20:25 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 16:48:33 2016 +0100
QtAutogen: Add moc compilation file to autogen target byproducts
Closes: #16389
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 276908d..9029751 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -678,22 +678,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 =
@@ -764,7 +769,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__)
@@ -791,10 +795,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);
@@ -828,7 +830,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=a84c119dcda402fdee1046330d9bf3785cdb8e62
commit a84c119dcda402fdee1046330d9bf3785cdb8e62
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 16:24:51 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 16:48:33 2016 +0100
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 c342f97..276908d 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=d2982298ba8821b53bc8c278d55a27aefc64043d
commit d2982298ba8821b53bc8c278d55a27aefc64043d
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 13:03:38 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 16:48:33 2016 +0100
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 614834c..c342f97 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=1e82c51485f745d4659f3f731134e62a43249381
commit 1e82c51485f745d4659f3f731134e62a43249381
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:13:59 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:29 2016 +0100
QtAutogen: Inline single use variable definitions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index cfa51cf..614834c 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=66f6eb6bc62b5d89c7440d896243a89edc167a2b
commit 66f6eb6bc62b5d89c7440d896243a89edc167a2b
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 12:10:51 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:29 2016 +0100
QtAutogen: Determine the Qt major version in only one way
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index b12045c..cfa51cf 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,33 +370,20 @@ 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) {
+ const std::string targetName = target->GetName();
+ if (qtMajorVersion == "5") {
cmGeneratorTarget* qt5Rcc = lg->FindGeneratorTargetToUse("Qt5::rcc");
if (!qt5Rcc) {
cmSystemTools::Error("Qt5::rcc target not found ", targetName.c_str());
return std::string();
}
return qt5Rcc->ImportedGetLocation("");
- }
- if (strcmp(qtVersion, "4") == 0) {
+ } else if (qtMajorVersion == "4") {
cmGeneratorTarget* qt4Rcc = lg->FindGeneratorTargetToUse("Qt4::rcc");
if (!qt4Rcc) {
cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str());
@@ -433,7 +435,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 +568,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 +585,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 +608,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 +651,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 +676,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 +862,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 +870,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 +896,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=58d36c8041dc2e2e2932b570b5e4d658f1a25ebc
commit 58d36c8041dc2e2e2932b570b5e4d658f1a25ebc
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 11:32:12 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:29 2016 +0100
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=88d2cd0c798ca2c1eb2070520879731518db906c
commit 88d2cd0c798ca2c1eb2070520879731518db906c
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Dec 2 11:21:52 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:29 2016 +0100
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 97585d2..3d48b03 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -990,8 +990,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";
}
@@ -1025,26 +1025,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;
+ }
}
}
}
@@ -1058,13 +1064,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();
@@ -1121,21 +1125,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;
}
@@ -1152,7 +1156,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) {
@@ -1166,12 +1170,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;
}
@@ -1246,20 +1249,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;
}
@@ -1279,7 +1281,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) {
@@ -1292,12 +1294,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=a75211647fa4acf4c1c847958fc9ff7d05351d84
commit a75211647fa4acf4c1c847958fc9ff7d05351d84
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Dec 1 18:15:32 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:29 2016 +0100
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=a24901c82eeef253079aefa4d2a6f86bc8ba80b6
commit a24901c82eeef253079aefa4d2a6f86bc8ba80b6
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Thu Dec 1 09:24:48 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:29 2016 +0100
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..444ec7f
--- /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);
+}
\ No newline at end of file
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 4d9cde5..97585d2 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"
@@ -401,6 +400,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();
@@ -971,8 +975,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;
@@ -988,8 +990,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);
@@ -1322,18 +1326,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";
}
}
@@ -1372,15 +1371,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=fda1290d0a06cff77af86b6e6d81677ca7ce82e0
commit fda1290d0a06cff77af86b6e6d81677ca7ce82e0
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:56:50 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
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 e30d547..4d9cde5 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -394,7 +394,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=9d0ef0ea14f76ca4b58db0bdcecdc2250d9a35a7
commit 9d0ef0ea14f76ca4b58db0bdcecdc2250d9a35a7
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:51:00 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
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 e8b214b..e30d547 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -396,8 +396,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;
@@ -484,10 +484,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;
@@ -1045,30 +1045,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"
@@ -1079,7 +1083,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=7201cc232e32a4aa9b9825c0ded5b4fcefbd4106
commit 7201cc232e32a4aa9b9825c0ded5b4fcefbd4106
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:12:50 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
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 e9afd31..e8b214b 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1393,7 +1393,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=bfeaa0d02ebf9ea44b03f378729728e95965308a
commit bfeaa0d02ebf9ea44b03f378729728e95965308a
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:08:41 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
QtAutogen: New common bold logging method
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index ec78879..e9afd31 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1081,11 +1081,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);
@@ -1123,11 +1121,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
@@ -1249,11 +1245,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
@@ -1399,11 +1393,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
@@ -1497,6 +1489,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=2c556b40f22295f2bcf69ec979f5f467bbe17387
commit 2c556b40f22295f2bcf69ec979f5f467bbe17387
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 22:02:32 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
QtAutogen: Make sure parent directory exists before writing files
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 293ffa4..ec78879 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -378,14 +378,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;
}
}
@@ -1088,14 +1087,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;
}
/**
@@ -1109,17 +1122,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);
@@ -1227,21 +1242,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);
@@ -1379,21 +1398,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");
@@ -1505,6 +1532,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=38cd817b719dcc6fd1750e1863ae6ac7fb923faa
commit 38cd817b719dcc6fd1750e1863ae6ac7fb923faa
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 21:17:38 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
QtAutogen: Improved error handling
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index fe585b4..293ffa4 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -519,10 +519,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);
}
@@ -572,7 +577,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,
@@ -588,11 +596,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(
@@ -656,7 +664,7 @@ void cmQtAutoGenerators::ParseCppFile(
<< std::endl;
}
this->LogError(err.str());
- ::exit(EXIT_FAILURE);
+ return false;
}
} else {
std::string fileToMoc = absFilename;
@@ -704,7 +712,7 @@ void cmQtAutoGenerators::ParseCppFile(
"header.\n"
<< std::endl;
this->LogError(err.str());
- ::exit(EXIT_FAILURE);
+ return false;
}
} else {
dotMocIncluded = true;
@@ -748,13 +756,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,
@@ -770,11 +782,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(
@@ -827,7 +839,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
<< std::endl;
}
this->LogError(err.str());
- ::exit(EXIT_FAILURE);
+ return false;
}
} else {
if (basename != scannedFileBasename) {
@@ -843,7 +855,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;
@@ -865,8 +877,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=ba973d446764631b14c369f9ddc773e27ccfb12f
commit ba973d446764631b14c369f9ddc773e27ccfb12f
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 21:08:54 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:28 2016 +0100
QtAutogen: Error and warning log method tweaks
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index f1412e5..fe585b4 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>
@@ -199,7 +200,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;
}
@@ -586,7 +587,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);
@@ -677,7 +678,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
@@ -690,7 +691,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;
@@ -734,7 +735,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);
@@ -768,7 +769,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);
@@ -880,7 +881,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);
@@ -1001,7 +1002,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;
}
}
@@ -1180,7 +1181,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;
}
}
@@ -1314,7 +1315,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;
}
}
@@ -1439,7 +1440,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)
{
@@ -1457,12 +1458,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=ddfd827c449a8ded9043dbf700950202e0d2ae2a
commit ddfd827c449a8ded9043dbf700950202e0d2ae2a
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 20:47:54 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: Improved error recognition
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 5ff589e..f1412e5 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -553,32 +553,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;
@@ -1015,7 +1002,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;
}
}
@@ -1096,6 +1083,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)
{
@@ -1140,12 +1130,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;
}
@@ -1187,7 +1181,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();
@@ -1211,6 +1205,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)
@@ -1257,13 +1254,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;
@@ -1316,7 +1315,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;
}
}
@@ -1334,6 +1333,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)
@@ -1391,16 +1393,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=6e8ac679a9a647101654da5b490f2b30a93f5f60
commit 6e8ac679a9a647101654da5b490f2b30a93f5f60
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 20:31:22 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: Improved error recognition on config load
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index c0a9b63..5ff589e 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,22 @@ 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;
+ }
+ }
+ if (!this->WriteOldMocDefinitionsFile(targetDirectory)) {
+ return false;
}
- this->WriteOldMocDefinitionsFile(targetDirectory);
-
- return success;
+ return true;
}
bool cmQtAutoGenerators::ReadAutogenInfoFile(
@@ -196,7 +198,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 +307,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 +352,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 +363,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 +1451,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);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69871e67e3b0612d7df8cc3ecf4a631850935e48
commit 69871e67e3b0612d7df8cc3ecf4a631850935e48
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 17:47:16 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: Comments
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index b150d88..76af466 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -681,6 +681,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
}
+ // Initialize autogen target dependencies
std::vector<std::string> depends;
if (const char* autogenDepends =
target->GetProperty("AUTOGEN_TARGET_DEPENDS")) {
@@ -737,6 +738,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// https://connect.microsoft.com/VisualStudio/feedback/details/769495
usePRE_BUILD = vsgg->GetVersion() >= cmGlobalVisualStudioGenerator::VS7;
if (usePRE_BUILD) {
+ // If the autogen target depends on an other target
+ // don't use PRE_BUILD
for (std::vector<std::string>::iterator it = depends.begin();
it != depends.end(); ++it) {
if (!makefile->FindTargetToUse(it->c_str())) {
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9360e288168b850223285d1fbd695abd33cf26eb
commit 9360e288168b850223285d1fbd695abd33cf26eb
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 17:09:32 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: For loop feature test optimization
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 7fbcff3..b150d88 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -755,20 +755,19 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|| usePRE_BUILD
#endif
) {
- std::vector<cmSourceFile*> srcFiles;
- target->GetConfigCommonSourceFiles(srcFiles);
- cmFilePathUuid fpathUuid(makefile);
- for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
- fileIt != srcFiles.end(); ++fileIt) {
- cmSourceFile* sf = *fileIt;
- std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath());
-
- std::string ext = sf->GetExtension();
-
- if (target->GetPropertyAsBool("AUTORCC")) {
- if (ext == "qrc" &&
+ if (target->GetPropertyAsBool("AUTORCC")) {
+ std::vector<cmSourceFile*> srcFiles;
+ target->GetConfigCommonSourceFiles(srcFiles);
+ cmFilePathUuid fpathUuid(makefile);
+ 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 rcc_output_file = GetAutogenTargetBuildDir(target);
// Create output directory
cmSystemTools::MakeDirectory(rcc_output_file.c_str());
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8548caa3ee9914f7bd25dba4dadbb1c3a6338253
commit 8548caa3ee9914f7bd25dba4dadbb1c3a6338253
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 16:38:31 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: Variable scope optimizations
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 4f20e1b..7fbcff3 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -671,54 +671,59 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
{
cmMakefile* makefile = target->Target->GetMakefile();
+ // Create a custom target for running generators at buildtime
+ const std::string autogenTargetName = GetAutogenTargetName(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");
}
- // create a custom target for running generators at buildtime:
- std::string autogenTargetName = GetAutogenTargetName(target);
-
- cmCustomCommandLine currentLine;
- currentLine.push_back(cmSystemTools::GetCMakeCommand());
- currentLine.push_back("-E");
- currentLine.push_back("cmake_autogen");
- currentLine.push_back(GetAutogenTargetFilesDir(target));
- currentLine.push_back("$<CONFIGURATION>");
-
- cmCustomCommandLines commandLines;
- commandLines.push_back(currentLine);
-
- std::string workingDirectory =
- cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
-
std::vector<std::string> depends;
if (const char* autogenDepends =
target->GetProperty("AUTOGEN_TARGET_DEPENDS")) {
cmSystemTools::ExpandListArgument(autogenDepends, depends);
}
- std::vector<std::string> toolNames;
- if (target->GetPropertyAsBool("AUTOMOC")) {
- toolNames.push_back("moc");
- }
- if (target->GetPropertyAsBool("AUTOUIC")) {
- toolNames.push_back("uic");
- }
- if (target->GetPropertyAsBool("AUTORCC")) {
- toolNames.push_back("rcc");
+
+ // Compose command lines
+ cmCustomCommandLines commandLines;
+ {
+ cmCustomCommandLine currentLine;
+ currentLine.push_back(cmSystemTools::GetCMakeCommand());
+ currentLine.push_back("-E");
+ currentLine.push_back("cmake_autogen");
+ currentLine.push_back(GetAutogenTargetFilesDir(target));
+ currentLine.push_back("$<CONFIGURATION>");
+ commandLines.push_back(currentLine);
}
- std::string tools = toolNames[0];
- toolNames.erase(toolNames.begin());
- while (toolNames.size() > 1) {
- tools += ", " + toolNames[0];
+ // Compose target comment
+ std::string autogenComment;
+ {
+ std::vector<std::string> toolNames;
+ if (target->GetPropertyAsBool("AUTOMOC")) {
+ toolNames.push_back("moc");
+ }
+ if (target->GetPropertyAsBool("AUTOUIC")) {
+ toolNames.push_back("uic");
+ }
+ if (target->GetPropertyAsBool("AUTORCC")) {
+ toolNames.push_back("rcc");
+ }
+
+ std::string tools = toolNames[0];
toolNames.erase(toolNames.begin());
+ while (toolNames.size() > 1) {
+ tools += ", " + toolNames[0];
+ toolNames.erase(toolNames.begin());
+ }
+ if (toolNames.size() == 1) {
+ tools += " and " + toolNames[0];
+ }
+ autogenComment = "Automatic " + tools + " for target " + target->GetName();
}
- if (toolNames.size() == 1) {
- tools += " and " + toolNames[0];
- }
- std::string autogenComment = "Automatic " + tools + " for target ";
- autogenComment += target->GetName();
#if defined(_WIN32) && !defined(__CYGWIN__)
bool usePRE_BUILD = false;
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d9c68e21a09646816232fa849536ceaca106fc5
commit 9d9c68e21a09646816232fa849536ceaca106fc5
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 13:42:55 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: Rename variable templates in config template
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 355d6d8..84b0f4d 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -1,6 +1,4 @@
set(AM_SOURCES @_cpp_files@ )
-set(AM_RCC_SOURCES @_rcc_files@ )
-set(AM_RCC_INPUTS @_qt_rcc_inputs@)
set(AM_SKIP_MOC @_skip_moc@ )
set(AM_SKIP_UIC @_skip_uic@ )
set(AM_HEADERS @_moc_headers@ )
@@ -22,5 +20,7 @@ set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@)
-set(AM_RCC_OPTIONS_FILES @_qt_rcc_options_files@)
-set(AM_RCC_OPTIONS_OPTIONS @_qt_rcc_options_options@)
+set(AM_RCC_SOURCES @_rcc_files@ )
+set(AM_RCC_INPUTS @_rcc_inputs@)
+set(AM_RCC_OPTIONS_FILES @_rcc_options_files@)
+set(AM_RCC_OPTIONS_OPTIONS @_rcc_options_options@)
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 4a7e814..4f20e1b 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -634,18 +634,15 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
}
}
makefile->AddDefinition(
- "_qt_rcc_inputs", cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
-
+ "_rcc_inputs", cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
makefile->AddDefinition(
"_rcc_files", cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
-
makefile->AddDefinition(
- "_qt_rcc_options_files",
+ "_rcc_options_files",
cmOutputConverter::EscapeForCMake(rccFileFiles).c_str());
makefile->AddDefinition(
- "_qt_rcc_options_options",
+ "_rcc_options_options",
cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
-
makefile->AddDefinition("_qt_rcc_executable",
RccGetExecutable(target).c_str());
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb8c96689fe692196e8f77df6d071656b161b47c
commit bb8c96689fe692196e8f77df6d071656b161b47c
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 13:30:59 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:27 2016 +0100
QtAutogen: Make strings const
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 384c336..4a7e814 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -429,7 +429,7 @@ static void RccMergeOptions(std::vector<std::string>& opts,
static bool RccListInputsQt5(cmSourceFile* sf, cmGeneratorTarget const* target,
std::vector<std::string>& depends)
{
- std::string rccCommand = RccGetExecutable(target);
+ const std::string rccCommand = RccGetExecutable(target);
bool hasDashDashList = false;
// Read rcc features
@@ -839,7 +839,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
static_cast<void>(varScope);
// create a custom target for running generators at buildtime:
- std::string autogenTargetName = GetAutogenTargetName(target);
+ const std::string autogenTargetName = GetAutogenTargetName(target);
makefile->AddDefinition(
"_moc_target_name",
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48180401d321e7fba19ac45e9e2e8a718c20d0b8
commit 48180401d321e7fba19ac45e9e2e8a718c20d0b8
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 13:14:23 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Rename config AM_RELAXED_MODE to AM_MOC_RELAXED_MODE
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 7d89420..355d6d8 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -7,6 +7,7 @@ set(AM_HEADERS @_moc_headers@ )
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
set(AM_MOC_INCLUDES @_moc_incs@)
set(AM_MOC_OPTIONS @_moc_options@)
+set(AM_MOC_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
@@ -18,7 +19,6 @@ set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@_target_qt_version@")
set(AM_TARGET_NAME @_moc_target_name@)
set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
-set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@)
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index fa33cf2..c0a9b63 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -320,7 +320,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
}
this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile);
- this->RelaxedMode = makefile->IsOn("AM_RELAXED_MODE");
+ this->MocRelaxedMode = makefile->IsOn("AM_MOC_RELAXED_MODE");
return true;
}
@@ -497,7 +497,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
err << "AUTOGEN: Checking " << absFilename << std::endl;
this->LogInfo(err.str());
}
- if (this->RelaxedMode) {
+ if (this->MocRelaxedMode) {
this->ParseCppFile(absFilename, headerExtensions, includedMocs, uiFiles);
} else {
this->StrictParseCppFile(absFilename, headerExtensions, includedMocs,
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 08d7e03..b26b307 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -132,7 +132,7 @@ private:
bool RunUicFailed;
bool RunRccFailed;
bool GenerateAll;
- bool RelaxedMode;
+ bool MocRelaxedMode;
};
#endif
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fa858ecb1b40e63c733047f07cc5049f7e2366a
commit 4fa858ecb1b40e63c733047f07cc5049f7e2366a
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 13:04:52 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Change config file permissions only on demand
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 576b2eb..384c336 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -888,26 +888,31 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
RccSetupAutoTarget(target);
}
+ // Generate config file
std::string inputFile = cmSystemTools::GetCMakeRoot();
inputFile += "/Modules/AutogenInfo.cmake.in";
std::string outputFile = GetAutogenTargetFilesDir(target);
outputFile += "/AutogenInfo.cmake";
+
makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true,
false);
- // Ensure we have write permission in case .in was read-only.
- mode_t perm = 0;
+ // Append custom definitions to config file
+ if (!configMocDefines.empty() || !configMocIncludes.empty() ||
+ !configUicOptions.empty()) {
+
+ // Ensure we have write permission in case .in was read-only.
+ mode_t perm = 0;
#if defined(_WIN32) && !defined(__CYGWIN__)
- mode_t mode_write = S_IWRITE;
+ mode_t mode_write = S_IWRITE;
#else
- mode_t mode_write = S_IWUSR;
+ mode_t mode_write = S_IWUSR;
#endif
- cmSystemTools::GetPermissions(outputFile, perm);
- if (!(perm & mode_write)) {
- cmSystemTools::SetPermissions(outputFile, perm | mode_write);
- }
- if (!configMocDefines.empty() || !configMocIncludes.empty() ||
- !configUicOptions.empty()) {
+ cmSystemTools::GetPermissions(outputFile, perm);
+ if (!(perm & mode_write)) {
+ cmSystemTools::SetPermissions(outputFile, perm | mode_write);
+ }
+
cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if (!infoFile) {
std::string error = "Internal CMake error when trying to open file: ";
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=273e481e48c855905bde4d91a986c06713df0183
commit 273e481e48c855905bde4d91a986c06713df0183
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 12:44:47 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Inline single use variable
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 1bdfe32..576b2eb 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -682,13 +682,11 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// create a custom target for running generators at buildtime:
std::string autogenTargetName = GetAutogenTargetName(target);
- std::string targetDir = GetAutogenTargetFilesDir(target);
-
cmCustomCommandLine currentLine;
currentLine.push_back(cmSystemTools::GetCMakeCommand());
currentLine.push_back("-E");
currentLine.push_back("cmake_autogen");
- currentLine.push_back(targetDir);
+ currentLine.push_back(GetAutogenTargetFilesDir(target));
currentLine.push_back("$<CONFIGURATION>");
cmCustomCommandLines commandLines;
@@ -850,8 +848,6 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
"_origin_target_name",
cmOutputConverter::EscapeForCMake(target->GetName()).c_str());
- std::string targetDir = GetAutogenTargetFilesDir(target);
-
const char* qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
if (!qtVersion) {
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
@@ -894,7 +890,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
std::string inputFile = cmSystemTools::GetCMakeRoot();
inputFile += "/Modules/AutogenInfo.cmake.in";
- std::string outputFile = targetDir;
+ std::string outputFile = GetAutogenTargetFilesDir(target);
outputFile += "/AutogenInfo.cmake";
makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true,
false);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f024008ce2bdf11bec1ff1174ee68f9a6da6fcb
commit 6f024008ce2bdf11bec1ff1174ee68f9a6da6fcb
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 12:23:04 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Remove unused intermediate definition in makefile
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 44323bc..1bdfe32 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -634,8 +634,7 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
}
}
makefile->AddDefinition(
- "_qt_rcc_inputs_" + target->GetName(),
- cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
+ "_qt_rcc_inputs", cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
makefile->AddDefinition(
"_rcc_files", cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
@@ -897,9 +896,6 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
inputFile += "/Modules/AutogenInfo.cmake.in";
std::string outputFile = targetDir;
outputFile += "/AutogenInfo.cmake";
- makefile->AddDefinition(
- "_qt_rcc_inputs",
- makefile->GetDefinition("_qt_rcc_inputs_" + target->GetName()));
makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true,
false);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff1a01b743dc70e555fb0fc61eb4d019eb25df76
commit ff1a01b743dc70e555fb0fc61eb4d019eb25df76
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 12:18:47 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Moc related variable renamed
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 4240914..44323bc 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -871,7 +871,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
std::vector<std::string> mocSources;
std::vector<std::string> mocHeaders;
std::map<std::string, std::string> configMocIncludes;
- std::map<std::string, std::string> configDefines;
+ std::map<std::string, std::string> configMocDefines;
std::map<std::string, std::string> configUicOptions;
if (target->GetPropertyAsBool("AUTOMOC") ||
@@ -884,7 +884,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str());
if (target->GetPropertyAsBool("AUTOMOC")) {
MocSetupAutoTarget(target, autogenTargetName, skipMoc, mocHeaders,
- configMocIncludes, configDefines);
+ configMocIncludes, configMocDefines);
}
if (target->GetPropertyAsBool("AUTOUIC")) {
UicSetupAutoTarget(target, skipUic, configUicOptions);
@@ -914,7 +914,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
if (!(perm & mode_write)) {
cmSystemTools::SetPermissions(outputFile, perm | mode_write);
}
- if (!configDefines.empty() || !configMocIncludes.empty() ||
+ if (!configMocDefines.empty() || !configMocIncludes.empty() ||
!configUicOptions.empty()) {
cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if (!infoFile) {
@@ -924,10 +924,10 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
cmSystemTools::Error(error.c_str());
return;
}
- if (!configDefines.empty()) {
+ if (!configMocDefines.empty()) {
for (std::map<std::string, std::string>::iterator
- it = configDefines.begin(),
- end = configDefines.end();
+ it = configMocDefines.begin(),
+ end = configMocDefines.end();
it != end; ++it) {
infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first << " "
<< it->second << ")\n";
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f448364de8cd2cd97933020fe0607d2fef3e1bcd
commit f448364de8cd2cd97933020fe0607d2fef3e1bcd
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 12:17:39 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Moc related variable renamed
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 7aa7118..4240914 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -870,7 +870,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
std::vector<std::string> skipMoc;
std::vector<std::string> mocSources;
std::vector<std::string> mocHeaders;
- std::map<std::string, std::string> configIncludes;
+ std::map<std::string, std::string> configMocIncludes;
std::map<std::string, std::string> configDefines;
std::map<std::string, std::string> configUicOptions;
@@ -884,7 +884,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str());
if (target->GetPropertyAsBool("AUTOMOC")) {
MocSetupAutoTarget(target, autogenTargetName, skipMoc, mocHeaders,
- configIncludes, configDefines);
+ configMocIncludes, configDefines);
}
if (target->GetPropertyAsBool("AUTOUIC")) {
UicSetupAutoTarget(target, skipUic, configUicOptions);
@@ -914,7 +914,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
if (!(perm & mode_write)) {
cmSystemTools::SetPermissions(outputFile, perm | mode_write);
}
- if (!configDefines.empty() || !configIncludes.empty() ||
+ if (!configDefines.empty() || !configMocIncludes.empty() ||
!configUicOptions.empty()) {
cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if (!infoFile) {
@@ -933,10 +933,10 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
<< it->second << ")\n";
}
}
- if (!configIncludes.empty()) {
+ if (!configMocIncludes.empty()) {
for (std::map<std::string, std::string>::iterator
- it = configIncludes.begin(),
- end = configIncludes.end();
+ it = configMocIncludes.begin(),
+ end = configMocIncludes.end();
it != end; ++it) {
infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second
<< ")\n";
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4eadf2ce3f90431fa3ae8a791fde432c6c60b5a1
commit 4eadf2ce3f90431fa3ae8a791fde432c6c60b5a1
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 11:25:57 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:26 2016 +0100
QtAutogen: Target directory name function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index d444039..7aa7118 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -62,7 +62,7 @@ static std::string GetAutogenTargetName(cmGeneratorTarget const* target)
return autogenTargetName;
}
-static std::string GetAutogenTargetDir(cmGeneratorTarget const* target)
+static std::string GetAutogenTargetFilesDir(cmGeneratorTarget const* target)
{
cmMakefile* makefile = target->Target->GetMakefile();
std::string targetDir = makefile->GetCurrentBinaryDirectory();
@@ -683,7 +683,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// create a custom target for running generators at buildtime:
std::string autogenTargetName = GetAutogenTargetName(target);
- std::string targetDir = GetAutogenTargetDir(target);
+ std::string targetDir = GetAutogenTargetFilesDir(target);
cmCustomCommandLine currentLine;
currentLine.push_back(cmSystemTools::GetCMakeCommand());
@@ -851,7 +851,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
"_origin_target_name",
cmOutputConverter::EscapeForCMake(target->GetName()).c_str());
- std::string targetDir = GetAutogenTargetDir(target);
+ std::string targetDir = GetAutogenTargetFilesDir(target);
const char* qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
if (!qtVersion) {
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e18801a1bf4e313fc2ec25d9a8842312728e1be
commit 2e18801a1bf4e313fc2ec25d9a8842312728e1be
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 11:19:28 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Move util functions to file begin
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index df15920..d444039 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -35,6 +35,26 @@
#include <utility>
#include <vector>
+static void utilCopyTargetProperty(cmTarget* destinationTarget,
+ cmTarget* sourceTarget,
+ const std::string& propertyName)
+{
+ const char* propertyValue = sourceTarget->GetProperty(propertyName);
+ if (propertyValue) {
+ destinationTarget->SetProperty(propertyName, propertyValue);
+ }
+}
+
+static std::string utilStripCR(std::string const& line)
+{
+ // Strip CR characters rcc may have printed (possibly more than one!).
+ std::string::size_type cr = line.find('\r');
+ if (cr != line.npos) {
+ return line.substr(0, cr);
+ }
+ return line;
+}
+
static std::string GetAutogenTargetName(cmGeneratorTarget const* target)
{
std::string autogenTargetName = target->GetName();
@@ -404,26 +424,6 @@ static void RccMergeOptions(std::vector<std::string>& opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-static void utilCopyTargetProperty(cmTarget* destinationTarget,
- cmTarget* sourceTarget,
- const std::string& propertyName)
-{
- const char* propertyValue = sourceTarget->GetProperty(propertyName);
- if (propertyValue) {
- destinationTarget->SetProperty(propertyName, propertyValue);
- }
-}
-
-static std::string utilStripCR(std::string const& line)
-{
- // Strip CR characters rcc may have printed (possibly more than one!).
- std::string::size_type cr = line.find('\r');
- if (cr != line.npos) {
- return line.substr(0, cr);
- }
- return line;
-}
-
/// @brief Reads the resource files list from from a .qrc file - Qt5 version
/// @return True if the .qrc file was successfully parsed
static bool RccListInputsQt5(cmSourceFile* sf, cmGeneratorTarget const* target,
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=048aac2cf99061c5fc13a67fb707b064db5c8660
commit 048aac2cf99061c5fc13a67fb707b064db5c8660
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 11:04:06 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Moc related setup function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index be10d1a..df15920 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -146,7 +146,7 @@ static void GetCompileDefinitionsAndDirectories(
defs += cmJoin(defines, ";");
}
-static void SetupAutoMocTarget(
+static void MocSetupAutoTarget(
cmGeneratorTarget const* target, const std::string& autogenTargetName,
std::vector<std::string> const& skipMoc,
std::vector<std::string> const& mocHeaders,
@@ -883,7 +883,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
"_cpp_files",
cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str());
if (target->GetPropertyAsBool("AUTOMOC")) {
- SetupAutoMocTarget(target, autogenTargetName, skipMoc, mocHeaders,
+ MocSetupAutoTarget(target, autogenTargetName, skipMoc, mocHeaders,
configIncludes, configDefines);
}
if (target->GetPropertyAsBool("AUTOUIC")) {
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9e220827810d693eefc7a2053bdb7b7de09ccf0
commit c9e220827810d693eefc7a2053bdb7b7de09ccf0
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:23:20 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Uic related function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 406a026..be10d1a 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -229,7 +229,7 @@ static void SetupAutoMocTarget(
}
}
-static void GetUicOpts(cmGeneratorTarget const* target,
+static void UicGetOpts(cmGeneratorTarget const* target,
const std::string& config, std::string& optString)
{
std::vector<std::string> opts;
@@ -259,7 +259,7 @@ static void UicSetupAutoTarget(
std::string _uic_opts;
std::vector<std::string> configs;
const std::string& config = makefile->GetConfigurations(configs);
- GetUicOpts(target, config, _uic_opts);
+ UicGetOpts(target, config, _uic_opts);
if (!_uic_opts.empty()) {
_uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts);
@@ -268,7 +268,7 @@ static void UicSetupAutoTarget(
for (std::vector<std::string>::const_iterator li = configs.begin();
li != configs.end(); ++li) {
std::string config_uic_opts;
- GetUicOpts(target, *li, config_uic_opts);
+ UicGetOpts(target, *li, config_uic_opts);
if (config_uic_opts != _uic_opts) {
configUicOptions[*li] =
cmOutputConverter::EscapeForCMake(config_uic_opts);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26505dfcb7afd993d0e0622c0904d355f9b2da3f
commit 26505dfcb7afd993d0e0622c0904d355f9b2da3f
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 11:04:58 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Uic related setup function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 340e9c3..406a026 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -237,7 +237,7 @@ static void GetUicOpts(cmGeneratorTarget const* target,
optString = cmJoin(opts, ";");
}
-static void SetupAutoUicTarget(
+static void UicSetupAutoTarget(
cmGeneratorTarget const* target, std::vector<std::string> const& skipUic,
std::map<std::string, std::string>& configUicOptions)
{
@@ -887,7 +887,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
configIncludes, configDefines);
}
if (target->GetPropertyAsBool("AUTOUIC")) {
- SetupAutoUicTarget(target, skipUic, configUicOptions);
+ UicSetupAutoTarget(target, skipUic, configUicOptions);
}
if (target->GetPropertyAsBool("AUTORCC")) {
RccSetupAutoTarget(target);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc055c04e1ebab4b3e1f8209f8e4697ccee5a58f
commit fc055c04e1ebab4b3e1f8209f8e4697ccee5a58f
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:24:19 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Rcc related function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 3de9159..340e9c3 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -331,7 +331,7 @@ static void SetupAutoUicTarget(
}
}
-static std::string GetRccExecutable(cmGeneratorTarget const* target)
+static std::string RccGetExecutable(cmGeneratorTarget const* target)
{
cmLocalGenerator* lg = target->GetLocalGenerator();
cmMakefile* makefile = target->Target->GetMakefile();
@@ -429,7 +429,7 @@ static std::string utilStripCR(std::string const& line)
static bool RccListInputsQt5(cmSourceFile* sf, cmGeneratorTarget const* target,
std::vector<std::string>& depends)
{
- std::string rccCommand = GetRccExecutable(target);
+ std::string rccCommand = RccGetExecutable(target);
bool hasDashDashList = false;
// Read rcc features
@@ -648,7 +648,7 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
makefile->AddDefinition("_qt_rcc_executable",
- GetRccExecutable(target).c_str());
+ RccGetExecutable(target).c_str());
}
void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9eba41479bc9f60cd810fa1786cb3baf3d570266
commit 9eba41479bc9f60cd810fa1786cb3baf3d570266
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:19:33 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Rcc related function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index a1ad8d2..3de9159 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -372,7 +372,7 @@ static std::string GetRccExecutable(cmGeneratorTarget const* target)
return std::string();
}
-static void MergeRccOptions(std::vector<std::string>& opts,
+static void RccMergeOptions(std::vector<std::string>& opts,
const std::vector<std::string>& fileOpts,
bool isQt5)
{
@@ -601,7 +601,7 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
if (const char* prop = sf->GetProperty("AUTORCC_OPTIONS")) {
std::vector<std::string> optsVec;
cmSystemTools::ExpandListArgument(prop, optsVec);
- MergeRccOptions(rccOptions, optsVec, strcmp(qtVersion, "5") == 0);
+ RccMergeOptions(rccOptions, optsVec, strcmp(qtVersion, "5") == 0);
}
if (!rccOptions.empty()) {
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=693d85f8d62d63ddf860637c69b8b239e7f22ad8
commit 693d85f8d62d63ddf860637c69b8b239e7f22ad8
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:13:26 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:25 2016 +0100
QtAutogen: Rcc related list function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index c97bfbc..a1ad8d2 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -426,7 +426,7 @@ static std::string utilStripCR(std::string const& line)
/// @brief Reads the resource files list from from a .qrc file - Qt5 version
/// @return True if the .qrc file was successfully parsed
-static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
+static bool RccListInputsQt5(cmSourceFile* sf, cmGeneratorTarget const* target,
std::vector<std::string>& depends)
{
std::string rccCommand = GetRccExecutable(target);
@@ -512,7 +512,7 @@ static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
/// @brief Reads the resource files list from from a .qrc file - Qt4 version
/// @return True if the .qrc file was successfully parsed
-static bool ListQt4RccInputs(cmSourceFile* sf,
+static bool RccListInputsQt4(cmSourceFile* sf,
std::vector<std::string>& depends)
{
// Read file into string
@@ -548,14 +548,14 @@ static bool ListQt4RccInputs(cmSourceFile* sf,
/// @brief Reads the resource files list from from a .qrc file
/// @return True if the rcc file was successfully parsed
-static bool ListQtRccInputs(const std::string& qtMajorVersion,
- cmSourceFile* sf, cmGeneratorTarget const* target,
- std::vector<std::string>& depends)
+static bool RccListInputs(const std::string& qtMajorVersion, cmSourceFile* sf,
+ cmGeneratorTarget const* target,
+ std::vector<std::string>& depends)
{
if (qtMajorVersion == "5") {
- return ListQt5RccInputs(sf, target, depends);
+ return RccListInputsQt5(sf, target, depends);
}
- return ListQt4RccInputs(sf, depends);
+ return RccListInputsQt4(sf, depends);
}
static void RccSetupAutoTarget(cmGeneratorTarget const* target)
@@ -621,7 +621,7 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target)
std::string entriesList;
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
std::vector<std::string> depends;
- if (ListQtRccInputs(qtMajorVersion, sf, target, depends)) {
+ if (RccListInputs(qtMajorVersion, sf, target, depends)) {
entriesList = cmJoin(depends, "@list_sep@");
} else {
return;
@@ -777,7 +777,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
rcc_output.push_back(rcc_output_file);
}
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
- ListQtRccInputs(qtMajorVersion, sf, target, depends);
+ RccListInputs(qtMajorVersion, sf, target, depends);
#if defined(_WIN32) && !defined(__CYGWIN__)
// Cannot use PRE_BUILD because the resource files themselves
// may not be sources within the target so VS may not know the
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43747ee8b345481d3f669e3df68010dabc15d014
commit 43747ee8b345481d3f669e3df68010dabc15d014
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:54:07 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:24 2016 +0100
QtAutogen: Rcc related setup function rename
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index fd7bb53..c97bfbc 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -558,7 +558,7 @@ static bool ListQtRccInputs(const std::string& qtMajorVersion,
return ListQt4RccInputs(sf, depends);
}
-static void SetupAutoRccTarget(cmGeneratorTarget const* target)
+static void RccSetupAutoTarget(cmGeneratorTarget const* target)
{
std::string _rcc_files;
const char* sepRccFiles = "";
@@ -890,7 +890,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
SetupAutoUicTarget(target, skipUic, configUicOptions);
}
if (target->GetPropertyAsBool("AUTORCC")) {
- SetupAutoRccTarget(target);
+ RccSetupAutoTarget(target);
}
std::string inputFile = cmSystemTools::GetCMakeRoot();
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8de8d3b191b020c499fdfdd8df237af95da946cd
commit 8de8d3b191b020c499fdfdd8df237af95da946cd
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:04:19 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:24 2016 +0100
QtAutogen: Remove and inline ReadAll function
The function was only used once.
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index fb94e90..fd7bb53 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -424,15 +424,6 @@ static std::string utilStripCR(std::string const& line)
return line;
}
-static std::string ReadAll(const std::string& filename)
-{
- cmsys::ifstream file(filename.c_str());
- std::ostringstream stream;
- stream << file.rdbuf();
- file.close();
- return stream.str();
-}
-
/// @brief Reads the resource files list from from a .qrc file - Qt5 version
/// @return True if the .qrc file was successfully parsed
static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
@@ -524,7 +515,13 @@ static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
static bool ListQt4RccInputs(cmSourceFile* sf,
std::vector<std::string>& depends)
{
- const std::string qrcContents = ReadAll(sf->GetFullPath());
+ // Read file into string
+ std::string qrcContents;
+ {
+ std::ostringstream stream;
+ stream << cmsys::ifstream(sf->GetFullPath().c_str()).rdbuf();
+ qrcContents = stream.str();
+ }
cmsys::RegularExpression fileMatchRegex("(<file[^<]+)");
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0283dc1859d61dc2cbdec0c8ee0b00214976c06
commit d0283dc1859d61dc2cbdec0c8ee0b00214976c06
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 10:17:41 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:24 2016 +0100
QtAutogen: Use shorter name for static function
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 27e9737..fb94e90 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -414,7 +414,7 @@ static void utilCopyTargetProperty(cmTarget* destinationTarget,
}
}
-static std::string cmQtAutoGeneratorsStripCR(std::string const& line)
+static std::string utilStripCR(std::string const& line)
{
// Strip CR characters rcc may have printed (possibly more than one!).
std::string::size_type cr = line.find('\r');
@@ -486,7 +486,7 @@ static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
std::istringstream ostr(rccStdOut);
std::string oline;
while (std::getline(ostr, oline)) {
- oline = cmQtAutoGeneratorsStripCR(oline);
+ oline = utilStripCR(oline);
if (!oline.empty()) {
depends.push_back(oline);
}
@@ -497,7 +497,7 @@ static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
std::istringstream estr(rccStdErr);
std::string eline;
while (std::getline(estr, eline)) {
- eline = cmQtAutoGeneratorsStripCR(eline);
+ eline = utilStripCR(eline);
if (cmHasLiteralPrefix(eline, "RCC: Error in")) {
static std::string searchString = "Cannot find file '";
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c9667e897f0342c40afa5db5947d87f89e557b1
commit 2c9667e897f0342c40afa5db5947d87f89e557b1
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Nov 30 11:12:14 2016 +0100
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Tue Dec 6 15:59:24 2016 +0100
QtAutogen: Use util prefix for static function name
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 8afd532..27e9737 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -404,9 +404,9 @@ static void MergeRccOptions(std::vector<std::string>& opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-static void copyTargetProperty(cmTarget* destinationTarget,
- cmTarget* sourceTarget,
- const std::string& propertyName)
+static void utilCopyTargetProperty(cmTarget* destinationTarget,
+ cmTarget* sourceTarget,
+ const std::string& propertyName)
{
const char* propertyValue = sourceTarget->GetProperty(propertyName);
if (propertyValue) {
@@ -828,7 +828,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
autogenTarget->SetProperty("FOLDER", autogenFolder);
} else {
// inherit FOLDER property from target (#13688)
- copyTargetProperty(gt->Target, target->Target, "FOLDER");
+ utilCopyTargetProperty(gt->Target, target->Target, "FOLDER");
}
target->Target->AddUtility(autogenTargetName);
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-qt.7.rst | 23 +-
Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst | 2 +-
Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst | 2 +-
Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst | 8 +-
Help/prop_tgt/AUTOMOC.rst | 13 +-
Help/release/dev/QtAutogen_Contain.rst | 10 +
Modules/AutogenInfo.cmake.in | 10 +-
Source/CMakeLists.txt | 4 +-
Source/cmFilePathChecksum.cxx | 88 ++++
Source/cmFilePathChecksum.h | 65 +++
Source/cmFilePathUuid.cxx | 118 ------
Source/cmFilePathUuid.h | 69 ---
Source/cmGeneratorTarget.cxx | 15 +
Source/cmGeneratorTarget.h | 6 +
Source/cmQtAutoGeneratorInitializer.cxx | 442 ++++++++++----------
Source/cmQtAutoGenerators.cxx | 531 ++++++++++++++----------
Source/cmQtAutoGenerators.h | 68 +--
Tests/QtAutoUicInterface/CMakeLists.txt | 7 +-
Tests/QtAutoUicInterface/libwidget.cpp | 5 +
Tests/QtAutoUicInterface/libwidget.h | 3 +-
Tests/QtAutoUicInterface/mywidget.cpp | 5 +
Tests/QtAutoUicInterface/mywidget.h | 3 +-
Tests/QtAutogen/CMakeLists.txt | 3 +-
Tests/QtAutogen/automoc_rerun/CMakeLists.txt | 2 +-
Tests/QtAutogen/autorcc_depends/CMakeLists.txt | 2 +-
Tests/QtAutogen/complex/Bdir/CMakeLists.txt | 1 -
Tests/QtAutogen/complex/CMakeLists.txt | 5 +-
Tests/QtAutogen/defines_test/CMakeLists.txt | 2 -
Tests/QtAutogen/sameName/CMakeLists.txt | 3 +-
Tests/QtAutogen/uicOnlySource/uiconly.cpp | 5 +
Tests/QtAutogen/uicOnlySource/uiconly.h | 4 +-
31 files changed, 827 insertions(+), 697 deletions(-)
create mode 100644 Help/release/dev/QtAutogen_Contain.rst
create mode 100644 Source/cmFilePathChecksum.cxx
create mode 100644 Source/cmFilePathChecksum.h
delete mode 100644 Source/cmFilePathUuid.cxx
delete mode 100644 Source/cmFilePathUuid.h
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list