Skip to content
Snippets Groups Projects
Commit bae84378 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'autogen-ui-header-depends'


283e8d8d AUTOUIC: Add test for cyclic dependency between UI headers and timestamp

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avataralcroito <alexandru.croitor@qt.io>
Merge-request: !6404
parents 519ce955 283e8d8d
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......@@ -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})
#include "mainwindow.h"
#include "ui_mainwindow.h"
extern bool subdircheck();
......
#include <QObject>
#include "ui_mainwindow.h"
class MainWindow : public QObject
{
Q_OBJECT
public:
MainWindow() { mwUi.setupUi(&mw); }
MocWidget mw;
Ui::Widget mwUi;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment