summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r--tests/auto/cmake/CMakeLists.txt12
-rw-r--r--tests/auto/cmake/test_QTBUG-63422/CMakeLists.txt30
-rw-r--r--tests/auto/cmake/test_QTBUG-63422/mywidget.cpp43
-rw-r--r--tests/auto/cmake/test_QTBUG-63422/mywidget.h52
-rw-r--r--tests/auto/cmake/test_QTBUG-63422/mywidget.ui34
-rw-r--r--tests/auto/cmake/test_QTBUG-63422/res.qrc4
6 files changed, 172 insertions, 3 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 0e6da23c09..40c86132e9 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -157,7 +157,13 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.11 AND NOT NO_WIDGETS)
expect_pass(test_interface)
endif()
-if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
- expect_pass(test_interface_link_libraries)
- expect_pass(test_moc_macro_target)
+expect_pass(test_interface_link_libraries)
+expect_pass(test_moc_macro_target)
+
+if (NOT CMAKE_VERSION VERSION_LESS 3.8)
+ # With earlier CMake versions, this test would simply run moc multiple times and lead to:
+ # /usr/bin/ld: error: CMakeFiles/mywidget.dir/mywidget_automoc.cpp.o: multiple definition of 'MyWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)'
+ # /usr/bin/ld: CMakeFiles/mywidget.dir/moc_mywidget.cpp.o: previous definition here
+ # Reason: SKIP_* properties were added in CMake 3.8 only
+ expect_pass(test_QTBUG-63422)
endif()
diff --git a/tests/auto/cmake/test_QTBUG-63422/CMakeLists.txt b/tests/auto/cmake/test_QTBUG-63422/CMakeLists.txt
new file mode 100644
index 0000000000..a0b82caee4
--- /dev/null
+++ b/tests/auto/cmake/test_QTBUG-63422/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 2.8)
+project(test_dependent_modules)
+
+find_package(Qt5Widgets REQUIRED)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+# make sure CMP0071 warnings cause a test failure
+set(CMAKE_SUPPRESS_DEVELOPER_ERRORS FALSE CACHE INTERNAL "" FORCE)
+
+qt5_wrap_cpp(moc_files mywidget.h)
+qt5_wrap_ui(ui_files mywidget.ui)
+qt5_add_resources(qrc_files res.qrc)
+
+add_executable(mywidget
+ # source files
+ mywidget.cpp
+ mywidget.h
+ mywidget.ui
+ res.qrc
+
+ # generated files
+ ${moc_files}
+ ${ui_files}
+ ${qrc_files}
+)
+target_link_libraries(mywidget ${Qt5Widgets_LIBRARIES})
diff --git a/tests/auto/cmake/test_QTBUG-63422/mywidget.cpp b/tests/auto/cmake/test_QTBUG-63422/mywidget.cpp
new file mode 100644
index 0000000000..7bc42537d5
--- /dev/null
+++ b/tests/auto/cmake/test_QTBUG-63422/mywidget.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Kevin Funk <kevin.funk@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mywidget.h"
+#include "ui_mywidget.h"
+
+MyWidget::MyWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ emit someSignal();
+}
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ MyWidget myWidget;
+ return 0;
+}
diff --git a/tests/auto/cmake/test_QTBUG-63422/mywidget.h b/tests/auto/cmake/test_QTBUG-63422/mywidget.h
new file mode 100644
index 0000000000..d0c79c0538
--- /dev/null
+++ b/tests/auto/cmake/test_QTBUG-63422/mywidget.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Kevin Funk <kevin.funk@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYWIDGET_H
+#define MYWIDGET_H
+
+#include <QWidget>
+
+namespace Ui
+{
+class MyWidget;
+}
+
+class MyWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ MyWidget(QWidget *parent = nullptr);
+
+signals:
+ void someSignal();
+
+private:
+ Ui::MyWidget *ui = nullptr;
+};
+
+#endif
diff --git a/tests/auto/cmake/test_QTBUG-63422/mywidget.ui b/tests/auto/cmake/test_QTBUG-63422/mywidget.ui
new file mode 100644
index 0000000000..ac42ac4dc2
--- /dev/null
+++ b/tests/auto/cmake/test_QTBUG-63422/mywidget.ui
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <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="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit"/>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="textEdit"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/cmake/test_QTBUG-63422/res.qrc b/tests/auto/cmake/test_QTBUG-63422/res.qrc
new file mode 100644
index 0000000000..4ca9cd5837
--- /dev/null
+++ b/tests/auto/cmake/test_QTBUG-63422/res.qrc
@@ -0,0 +1,4 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+</qresource>
+</RCC>