mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
AUTOUIC: Add test for cyclic dependency between UI headers and timestamp
Follow up test for the commit 9cebdbec.
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
extern bool subdircheck();
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user