summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2024-12-02 11:42:26 (GMT)
committerOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2024-12-04 11:37:13 (GMT)
commitdebc4d39069faecba2cf8c6263bb7d974c3bf34b (patch)
tree4b764acce40d2b7de928d333e50661424c63d9de /Tests/RunCMake
parent27647acc6ca9c7e207478ec548ec7e12c4fbef8c (diff)
downloadCMake-debc4d39069faecba2cf8c6263bb7d974c3bf34b.zip
CMake-debc4d39069faecba2cf8c6263bb7d974c3bf34b.tar.gz
CMake-debc4d39069faecba2cf8c6263bb7d974c3bf34b.tar.bz2
Autogen: Revert adding ui files to byproducts of the timestamp target
When `ui_` include directives have different paths than `CMakeLists.txt`, the dependency graph is not generated correctly. This is the root cause of #16776. However, when #26135 was fixed by commit 5363bebc1e (Autogen: Fix compilation of unchanged source files, 2024-07-16, v3.31.0-rc1~328^2), it made #16776 worse: the build is always dirty. Revert the fix for now. Fixes: #26485 Issue: #26135 Issue: #25436
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/Autogen_6/RunCMakeTest.cmake27
-rw-r--r--Tests/RunCMake/Autogen_6/incremental_build/CMakeLists.txt (renamed from Tests/RunCMake/Autogen_6/multi_ui_files/CMakeLists.txt)14
-rw-r--r--Tests/RunCMake/Autogen_6/incremental_build/main.cpp (renamed from Tests/RunCMake/Autogen_6/multi_ui_files/src/main.cpp)4
-rw-r--r--Tests/RunCMake/Autogen_6/incremental_build/ui/widget.cpp15
-rw-r--r--Tests/RunCMake/Autogen_6/incremental_build/ui/widget.h23
-rw-r--r--Tests/RunCMake/Autogen_6/incremental_build/ui/widget.ui19
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.cpp25
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.h22
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.ui33
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.cpp22
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.h23
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.ui52
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.cpp22
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.h24
-rw-r--r--Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.ui45
15 files changed, 76 insertions, 294 deletions
diff --git a/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake
index 66514f9..65d58a9 100644
--- a/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
+
include(RunCMake)
include(Autogen_common/utils)
@@ -6,23 +7,22 @@ if (DEFINED with_qt_version)
-Dwith_qt_version=${with_qt_version}
"-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
"-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
- "-DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON"
)
if (QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
macro(set_test_variables_for_unwanted_builds)
if (RunCMake_GENERATOR MATCHES "Ninja")
- set(RunCMake_TEST_NOT_EXPECT_stdout "widget2.cpp.o.d|mainwindow.cpp.o.d")
+ set(RunCMake_TEST_EXPECT_stdout "ninja: no work to do.")
elseif (RunCMake_GENERATOR MATCHES "Make")
- set(RunCMake_TEST_NOT_EXPECT_stdout "Building CXX object multi_ui_files/CMakeFiles/example.dir/src/widget2.cpp.o|\
- Building CXX object multi_ui_files/CMakeFiles/example.dir/src/mainwindow.cpp.o")
+ set(RunCMake_TEST_NOT_EXPECT_stdout "Building CXX object multi_ui_files/CMakeFiles/example.dir/src/main.cpp.o|\
+ Building CXX object multi_ui_files/CMakeFiles/example.dir/src/widget.cpp.o")
elseif (RunCMake_GENERATOR MATCHES "Visual Studio")
- set(RunCMake_TEST_NOT_EXPECT_stdout "widget2.cpp|mainwindow.cpp")
+ set(RunCMake_TEST_NOT_EXPECT_stdout "widget.cpp")
elseif (RunCMake_GENERATOR MATCHES "Xcode")
- set(RunCMake_TEST_NOT_EXPECT_stdout "widget2.cpp|mainwindow.cpp")
+ set(RunCMake_TEST_NOT_EXPECT_stdout "widget.cpp")
endif()
endmacro()
- function(uic_build_test test_name binary_dir source_dir file_to_touch test_config)
+ function(uic_incremental_build_test test_name binary_dir source_dir test_config)
set(RunCMake_TEST_BINARY_DIR ${binary_dir})
set(RunCMake_TEST_SOURCE_DIR ${source_dir})
@@ -39,13 +39,14 @@ if (DEFINED with_qt_version)
endif()
run_cmake_with_options(${test_name} ${RunCMake_TEST_OPTIONS} ${config_arg})
set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "${RunCMake_TEST_VARIANT_DESCRIPTION}-First build")
+ run_cmake_command("${test_name}-build" ${CMAKE_COMMAND} --build . ${test_verbose_arg} ${multiconfig_config_arg})
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "${config_desc}-Second build")
run_cmake_command("${test_name}-build" ${CMAKE_COMMAND} --build . ${test_verbose_arg} ${multiconfig_config_arg})
- file(TOUCH ${file_to_touch})
- set(RunCMake_TEST_VARIANT_DESCRIPTION "${config_desc}-first_build_after_touching")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "${config_desc}-No files were built on the third build")
set_test_variables_for_unwanted_builds()
run_cmake_command("${test_name}-build" ${CMAKE_COMMAND} --build . ${test_verbose_arg} ${multiconfig_config_arg})
- message(STATUS "${test_name}-build${config_desc}-Only build files that were touched were built - PASSED")
endfunction()
if(RunCMake_GENERATOR MATCHES "Make|Ninja|Visual Studio|Xcode")
@@ -60,11 +61,9 @@ if (DEFINED with_qt_version)
set(config_desc "-${config}")
endif()
- uic_build_test(multi_ui_files_touch_ui ${RunCMake_BINARY_DIR}/multi_ui_files_touch_ui${config_desc}-build
- ${RunCMake_SOURCE_DIR}/multi_ui_files ${RunCMake_SOURCE_DIR}/multi_ui_files/src/widget1.ui ${config})
+ uic_incremental_build_test(incremental_build_test ${RunCMake_BINARY_DIR}/incremental_build${config_desc}-build
+ ${RunCMake_SOURCE_DIR}/incremental_build ${config})
- uic_build_test(multi_ui_files_touch_cpp ${RunCMake_BINARY_DIR}/multi_ui_files_touch_cpp${config_desc}-build
- ${RunCMake_SOURCE_DIR}/multi_ui_files ${RunCMake_SOURCE_DIR}/multi_ui_files/src/widget1.cpp ${config})
endforeach()
endif()
endif()
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/CMakeLists.txt b/Tests/RunCMake/Autogen_6/incremental_build/CMakeLists.txt
index a4f7206..1796b8f 100644
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/CMakeLists.txt
+++ b/Tests/RunCMake/Autogen_6/incremental_build/CMakeLists.txt
@@ -8,16 +8,10 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
add_executable(example
- src/mainwindow.ui
- src/widget1.ui
- src/widget2.ui
- src/mainwindow.h
- src/widget1.h
- src/widget2.h
- src/main.cpp
- src/mainwindow.cpp
- src/widget1.cpp
- src/widget2.cpp
+ main.cpp
+ ui/widget.cpp
+ ui/widget.h
+ ui/widget.ui
)
target_link_libraries(example PRIVATE Qt${with_qt_version}::Widgets
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/main.cpp b/Tests/RunCMake/Autogen_6/incremental_build/main.cpp
index 8d76ad9..c15abe4 100644
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/main.cpp
+++ b/Tests/RunCMake/Autogen_6/incremental_build/main.cpp
@@ -1,11 +1,11 @@
#include <QApplication>
-#include "mainwindow.h"
+#include "ui/widget.h"
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
- MainWindow w;
+ Widget w;
w.show();
return a.exec();
}
diff --git a/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.cpp b/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.cpp
new file mode 100644
index 0000000..4de4ed2
--- /dev/null
+++ b/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.cpp
@@ -0,0 +1,15 @@
+#include "widget.h"
+
+#include "./ui_widget.h"
+
+Widget::Widget(QWidget* parent)
+ : QWidget(parent)
+ , ui(new Ui::Widget)
+{
+ ui->setupUi(this);
+}
+
+Widget::~Widget()
+{
+ delete ui;
+}
diff --git a/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.h b/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.h
new file mode 100644
index 0000000..2243ffe
--- /dev/null
+++ b/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.h
@@ -0,0 +1,23 @@
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+class Widget;
+}
+QT_END_NAMESPACE
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Widget(QWidget* parent = nullptr);
+ ~Widget();
+
+private:
+ Ui::Widget* ui;
+};
+#endif // WIDGET_H
diff --git a/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.ui b/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.ui
new file mode 100644
index 0000000..b90248d
--- /dev/null
+++ b/Tests/RunCMake/Autogen_6/incremental_build/ui/widget.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Widget</class>
+ <widget class="QWidget" name="Widget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Widget</string>
+ </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.cpp b/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.cpp
deleted file mode 100644
index eb3d366..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "mainwindow.h"
-
-#include <QVBoxLayout>
-
-#include "src/ui_mainwindow.h"
-#include "widget1.h"
-
-MainWindow::MainWindow(QWidget* parent)
- : QMainWindow(parent)
- , ui(new Ui::MainWindow)
-{
- ui->setupUi(this);
- auto layout = new QVBoxLayout;
- layout->addWidget(new Widget1);
-
- QWidget* w = new QWidget(this);
- w->setLayout(layout);
-
- setCentralWidget(w);
-}
-
-MainWindow::~MainWindow()
-{
- delete ui;
-}
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.h b/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.h
deleted file mode 100644
index 3e64459..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-QT_BEGIN_NAMESPACE
-namespace Ui {
-class MainWindow;
-}
-QT_END_NAMESPACE
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-public:
- MainWindow(QWidget* parent = nullptr);
- ~MainWindow();
-
-private:
- Ui::MainWindow* ui;
-};
-#endif // MAINWINDOW_H
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.ui b/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.ui
deleted file mode 100644
index 828d7c1..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/mainwindow.ui
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>600</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MainWindow</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QGridLayout" name="gridLayout"/>
- </widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>800</width>
- <height>22</height>
- </rect>
- </property>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.cpp b/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.cpp
deleted file mode 100644
index 05657ce..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "widget1.h"
-
-#include "src/ui_widget1.h"
-
-Widget1::Widget1(QWidget* parent)
- : QWidget(parent)
- , ui(new Ui::Widget1)
-{
- ui->setupUi(this);
- connect(ui->lineEdit, SIGNAL(textChanged(const QString&)), this,
- SLOT(onTextChanged(const QString&)));
-}
-
-Widget1::~Widget1()
-{
- delete ui;
-}
-
-void Widget1::onTextChanged(const QString& text)
-{
- ui->OnTextChanged->setText(text);
-}
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.h b/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.h
deleted file mode 100644
index 8c28d6d..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef WIDGET1_H
-#define WIDGET1_H
-
-#include <QWidget>
-
-namespace Ui {
-class Widget1;
-}
-
-class Widget1 : public QWidget
-{
- Q_OBJECT
-public:
- explicit Widget1(QWidget* parent = nullptr);
- ~Widget1();
-public slots:
- void onTextChanged(const QString& text);
-
-private:
- Ui::Widget1* ui;
-};
-
-#endif // WIDGET1_H
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.ui b/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.ui
deleted file mode 100644
index db0c58d..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget1.ui
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Widget1</class>
- <widget class="QWidget" name="Widget1">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Input:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="lineEdit"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>OnTextChanged:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="OnTextChanged">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.cpp b/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.cpp
deleted file mode 100644
index 7f4bbaf..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "widget2.h"
-
-#include "src/ui_widget2.h"
-
-Widget2::Widget2(QWidget* parent)
- : QWidget(parent)
- , ui(new Ui::Widget2)
-{
- ui->setupUi(this);
- connect(ui->lineEdit, SIGNAL(textChanged(const QString&)), this,
- SLOT(onTextChanged(const QString&)));
-}
-
-Widget2::~Widget2()
-{
- delete ui;
-}
-
-void Widget2::onTextChanged(const QString& text)
-{
- ui->OnTextChanged->setText(text);
-}
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.h b/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.h
deleted file mode 100644
index 41d7e1f..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef WIDGET2_H
-#define WIDGET2_H
-
-#include <QWidget>
-
-namespace Ui {
-class Widget2;
-}
-
-class Widget2 : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit Widget2(QWidget* parent = nullptr);
- ~Widget2();
-public slots:
- void onTextChanged(const QString& text);
-
-private:
- Ui::Widget2* ui;
-};
-
-#endif // WIDGET2_H
diff --git a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.ui b/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.ui
deleted file mode 100644
index facf467..0000000
--- a/Tests/RunCMake/Autogen_6/multi_ui_files/src/widget2.ui
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Widget2</class>
- <widget class="QWidget" name="Widget2">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Input:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="lineEdit"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>OnTextChanged:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="OnTextChanged">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>