summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-08-02 18:03:42 +0000
committerKitware Robot <kwrobot@kitware.com>2021-08-02 14:04:08 -0400
commit00535bab00e8dc4f447d462c6c665ed7a4cdb9b4 (patch)
tree96d1487fc01ab0200fe8ec4babb3e9d1f98ac455
parent28ce8a932d3ab84f32ecfa5e21501b65187d7441 (diff)
parent283e8d8d0475dd38e7ee52093fd033225f858d07 (diff)
downloadcmake-00535bab00e8dc4f447d462c6c665ed7a4cdb9b4.tar.gz
Merge topic 'autogen-ui-header-depends' into release-3.21
283e8d8d04 AUTOUIC: Add test for cyclic dependency between UI headers and timestamp Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: alcroito <alexandru.croitor@qt.io> Merge-request: !6404
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt13
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in8
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp1
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h13
4 files changed, 33 insertions, 2 deletions
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
index a9ccece5d5..a3ba9fbd40 100644
--- a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
@@ -26,6 +26,7 @@ macro(rebuild buildName)
endmacro()
configure_file("${testProjectTemplateDir}/mocwidget.h" "${testProjectSrc}/mocwidget.h" COPYONLY)
+configure_file("${testProjectTemplateDir}/mainwindow.h" "${testProjectSrc}/mainwindow.h" COPYONLY)
configure_file("${testProjectTemplateDir}/main.cpp" "${testProjectSrc}/main.cpp" COPYONLY)
configure_file("${testProjectTemplateDir}/subdir/subdircheck.cpp" "${testProjectSrc}/subdir/subdircheck.cpp" COPYONLY)
configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY)
@@ -103,3 +104,15 @@ execute_process(COMMAND "${testProjectBinDir}/${extra_bin_path}UicOnFileChange"
if(NOT result EQUAL "0")
message(FATAL_ERROR "Rebuild of UicOnFileChange test result is: ${result}")
endif()
+
+# Check if the generated ui_mainwindow.h rules introduce circular dependency between the generated
+# ui_mainwinow.h and timestamp.
+#
+# The first rebuild updates a timestamp dependency file after "touching" mainwindow.h.
+sleep()
+execute_process(COMMAND ${CMAKE_COMMAND} -E touch "${testProjectSrc}/mainwindow.h")
+rebuild(3)
+
+# The second rebuild detects if cycling dependency is introduced by deps file.
+sleep()
+rebuild(4)
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
index 2a1998d10f..c77075ca1e 100644
--- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
@@ -5,9 +5,13 @@ include("@CMAKE_CURRENT_LIST_DIR@/../AutogenGuiTest.cmake")
# Enable CMAKE_AUTOUIC for all targets
set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTOMOC ON)
-add_executable(UicOnFileChange main.cpp mainwindow.ui
+add_executable(UicOnFileChange main.cpp mainwindow.ui mainwindow.h
subdir/subdircheck.cpp subdir/mainwindowsubdir.ui
)
-target_include_directories(UicOnFileChange PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(UicOnFileChange PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}/UicOnFileChange_autogen/include"
+)
target_link_libraries(UicOnFileChange ${QT_QTCORE_TARGET} ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp
index 3981268846..99de13dccf 100644
--- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp
@@ -1,3 +1,4 @@
+#include "mainwindow.h"
#include "ui_mainwindow.h"
extern bool subdircheck();
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h
new file mode 100644
index 0000000000..24621ffb01
--- /dev/null
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h
@@ -0,0 +1,13 @@
+#include <QObject>
+
+#include "ui_mainwindow.h"
+
+class MainWindow : public QObject
+{
+ Q_OBJECT
+public:
+ MainWindow() { mwUi.setupUi(&mw); }
+
+ MocWidget mw;
+ Ui::Widget mwUi;
+};