summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/MocIncludeRelaxed
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-12-08 18:40:17 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-12-13 12:50:17 (GMT)
commitcc66d356510c51b5240239a212a511fb0d23dc9a (patch)
tree5a844861aebf5ede3030bc2aedad2bea6d02298e /Tests/QtAutogen/MocIncludeRelaxed
parent7971202b3c58f78008f5b651c048910fcc49c49f (diff)
downloadCMake-cc66d356510c51b5240239a212a511fb0d23dc9a.zip
CMake-cc66d356510c51b5240239a212a511fb0d23dc9a.tar.gz
CMake-cc66d356510c51b5240239a212a511fb0d23dc9a.tar.bz2
Autogen: Tests: Separate MocInclude test
Diffstat (limited to 'Tests/QtAutogen/MocIncludeRelaxed')
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt20
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp12
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp12
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp14
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp22
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp14
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp14
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp30
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp14
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/main.cpp26
10 files changed, 178 insertions, 0 deletions
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
new file mode 100644
index 0000000..b1c4fc3
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.10)
+project(MocIncludeRelaxed)
+include("../AutogenTest.cmake")
+
+# Test moc include patterns
+set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
+
+# Shared executable
+set(MOC_INCLUDE_NAME "mocIncludeRelaxed")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake)
+
+# Relaxed ony executable
+add_executable(mocIncludeRelaxedOnly
+ RObjA.cpp
+ RObjB.cpp
+ RObjC.cpp
+ RMain.cpp
+)
+target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES})
+set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp
new file mode 100644
index 0000000..5b2c070
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp
@@ -0,0 +1,12 @@
+// Relaxed AUTOMOC objects
+#include "RObjA.hpp"
+#include "RObjB.hpp"
+#include "RObjC.hpp"
+
+int main(int argv, char** args)
+{
+ RObjA rObjA;
+ RObjB rObjB;
+ RObjC rObjC;
+ return 0;
+}
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp
new file mode 100644
index 0000000..2e2cf6a
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp
@@ -0,0 +1,12 @@
+#include "RObjA.hpp"
+
+RObjA::RObjA()
+{
+}
+
+RObjA::~RObjA()
+{
+}
+
+// Relaxed include should moc the header instead
+#include "RObjA.moc"
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp
new file mode 100644
index 0000000..5974187
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJA_HPP
+#define ROBJA_HPP
+
+#include <QObject>
+
+class RObjA : public QObject
+{
+ Q_OBJECT
+public:
+ RObjA();
+ ~RObjA();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp
new file mode 100644
index 0000000..c56d10f
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp
@@ -0,0 +1,22 @@
+#include "RObjB.hpp"
+#include "RObjBExtra.hpp"
+
+RObjBExtra::RObjBExtra()
+{
+}
+
+RObjBExtra::~RObjBExtra()
+{
+}
+
+RObjB::RObjB()
+{
+ RObjBExtra extraObject;
+}
+
+RObjB::~RObjB()
+{
+}
+
+// Relaxed mode should run moc on RObjBExtra.hpp instead
+#include "RObjBExtra.moc"
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp
new file mode 100644
index 0000000..d6d0474
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJB_HPP
+#define ROBJB_HPP
+
+#include <QObject>
+
+class RObjB : public QObject
+{
+ Q_OBJECT
+public:
+ RObjB();
+ ~RObjB();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp
new file mode 100644
index 0000000..5d6be75
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJBEXTRA_HPP
+#define ROBJBEXTRA_HPP
+
+#include <QObject>
+
+class RObjBExtra : public QObject
+{
+ Q_OBJECT
+public:
+ RObjBExtra();
+ ~RObjBExtra();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp
new file mode 100644
index 0000000..4ba32f5
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp
@@ -0,0 +1,30 @@
+#include "RObjC.hpp"
+#include <QObject>
+
+class RObjCPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ RObjCPrivate();
+ ~RObjCPrivate();
+};
+
+RObjCPrivate::RObjCPrivate()
+{
+}
+
+RObjCPrivate::~RObjCPrivate()
+{
+}
+
+RObjC::RObjC()
+{
+ RObjCPrivate privateObject;
+}
+
+RObjC::~RObjC()
+{
+}
+
+// Relaxed include should moc this source instead of the header
+#include "moc_RObjC.cpp"
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp
new file mode 100644
index 0000000..5552ede
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJC_HPP
+#define ROBJC_HPP
+
+#include <QObject>
+
+class RObjC : public QObject
+{
+ Q_OBJECT
+public:
+ RObjC();
+ ~RObjC();
+};
+
+#endif
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/main.cpp b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp
new file mode 100644
index 0000000..5a3148d
--- /dev/null
+++ b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp
@@ -0,0 +1,26 @@
+#include "EObjA.hpp"
+#include "EObjB.hpp"
+#include "LObjA.hpp"
+#include "LObjB.hpp"
+#include "ObjA.hpp"
+#include "ObjB.hpp"
+#include "SObjA.hpp"
+#include "SObjB.hpp"
+#include "subGlobal/GObj.hpp"
+
+int main(int argv, char** args)
+{
+ subGlobal::GObj gObj;
+ ObjA objA;
+ ObjB objB;
+ LObjA lObjA;
+ LObjB lObjB;
+ EObjA eObjA;
+ EObjB eObjB;
+ SObjA sObjA;
+ SObjB sObjB;
+ return 0;
+}
+
+// Header in global subdirectory
+#include "subGlobal/moc_GObj.cpp"