summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-02-16 14:59:56 (GMT)
committerBrad King <brad.king@kitware.com>2017-02-21 15:38:49 (GMT)
commit39c4819eaa4f680411a63701b1303d79a088aece (patch)
tree1588c2a9e6d0595552e542791bee12cc821c450d
parent50805693ba987fbf86bb5e8263d7b427cd4da0c2 (diff)
downloadCMake-39c4819eaa4f680411a63701b1303d79a088aece.zip
CMake-39c4819eaa4f680411a63701b1303d79a088aece.tar.gz
CMake-39c4819eaa4f680411a63701b1303d79a088aece.tar.bz2
Autogen: Tests: Add moc include tests
-rw-r--r--Tests/QtAutogen/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA.cpp24
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB.cpp25
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjC.cpp26
-rw-r--r--Tests/QtAutogen/mocInclude/ObjC.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjD.cpp26
-rw-r--r--Tests/QtAutogen/mocInclude/ObjD.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/subA/SubObjA.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subA/SubObjA.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subB/SubObjB.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subB/SubObjB.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subC/SubObjC.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subC/SubObjC.hpp16
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt18
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/main.cpp14
-rw-r--r--Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt18
-rw-r--r--Tests/QtAutogen/mocIncludeStrict/main.cpp14
19 files changed, 354 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index c1cdee2..40c23fa 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -207,5 +207,13 @@ target_link_libraries(skipRccB ${QT_LIBRARIES})
add_subdirectory(sameName)
# -- Test
+# Tests various include moc patterns
+add_subdirectory(mocIncludeStrict)
+
+# -- Test
+# Tests various include moc patterns
+add_subdirectory(mocIncludeRelaxed)
+
+# -- Test
# Complex test case
add_subdirectory(complex)
diff --git a/Tests/QtAutogen/mocInclude/ObjA.cpp b/Tests/QtAutogen/mocInclude/ObjA.cpp
new file mode 100644
index 0000000..1b0311d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjA.cpp
@@ -0,0 +1,24 @@
+#include "ObjA.hpp"
+
+class SubObjA : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjA() {}
+ ~SubObjA() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjA::aSlot()
+{
+}
+
+void ObjA::go()
+{
+ SubObjA subObj;
+}
+
+#include "ObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/ObjA.hpp b/Tests/QtAutogen/mocInclude/ObjA.hpp
new file mode 100644
index 0000000..281e90d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjA.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJA_HPP
+#define OBJA_HPP
+
+#include <QObject>
+
+class ObjA : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjB.cpp b/Tests/QtAutogen/mocInclude/ObjB.cpp
new file mode 100644
index 0000000..5ff315d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjB.cpp
@@ -0,0 +1,25 @@
+#include "ObjB.hpp"
+
+class SubObjB : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjB() {}
+ ~SubObjB() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjB::aSlot()
+{
+}
+
+void ObjB::go()
+{
+ SubObjB subObj;
+}
+
+#include "ObjB.moc"
+#include "moc_ObjB.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjB.hpp b/Tests/QtAutogen/mocInclude/ObjB.hpp
new file mode 100644
index 0000000..94f3d49
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjB.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJB_HPP
+#define OBJB_HPP
+
+#include <QObject>
+
+class ObjB : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjC.cpp b/Tests/QtAutogen/mocInclude/ObjC.cpp
new file mode 100644
index 0000000..8ca34cb
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjC.cpp
@@ -0,0 +1,26 @@
+#include "ObjC.hpp"
+
+class SubObjC : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjC() {}
+ ~SubObjC() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjC::aSlot()
+{
+}
+
+void ObjC::go()
+{
+ SubObjC subObj;
+}
+
+#include "ObjC.moc"
+// Not the own header
+#include "moc_ObjD.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjC.hpp b/Tests/QtAutogen/mocInclude/ObjC.hpp
new file mode 100644
index 0000000..a8e98eb
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjC.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJC_HPP
+#define OBJC_HPP
+
+#include <QObject>
+
+class ObjC : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjD.cpp b/Tests/QtAutogen/mocInclude/ObjD.cpp
new file mode 100644
index 0000000..c18aec1
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjD.cpp
@@ -0,0 +1,26 @@
+#include "ObjD.hpp"
+
+class SubObjD : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjD() {}
+ ~SubObjD() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjD::aSlot()
+{
+}
+
+void ObjD::go()
+{
+ SubObjD subObj;
+}
+
+#include "ObjD.moc"
+// Header in subdirectory
+#include "subA/moc_SubObjA.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjD.hpp b/Tests/QtAutogen/mocInclude/ObjD.hpp
new file mode 100644
index 0000000..b6ee098
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjD.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJD_HPP
+#define OBJD_HPP
+
+#include <QObject>
+
+class ObjD : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp b/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
new file mode 100644
index 0000000..a05f6e3
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
@@ -0,0 +1,27 @@
+#include "SubObjA.hpp"
+
+namespace subA {
+
+class SubObjA : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjA() {}
+ ~SubObjA() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjA::aSlot()
+{
+}
+
+void ObjA::go()
+{
+ SubObjA subObj;
+}
+}
+
+#include "SubObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp b/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
new file mode 100644
index 0000000..31a18b6
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
@@ -0,0 +1,16 @@
+#ifndef SUBOBJA_HPP
+#define SUBOBJA_HPP
+
+#include <QObject>
+
+namespace subA {
+
+class ObjA : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp b/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
new file mode 100644
index 0000000..1e77639
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
@@ -0,0 +1,27 @@
+#include "SubObjB.hpp"
+
+namespace subB {
+
+class SubObjB : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjB() {}
+ ~SubObjB() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjB::aSlot()
+{
+}
+
+void ObjB::go()
+{
+ SubObjB subObj;
+}
+}
+
+#include "SubObjB.moc"
diff --git a/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp b/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
new file mode 100644
index 0000000..3f29fa2
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
@@ -0,0 +1,16 @@
+#ifndef SUBOBJB_HPP
+#define SUBOBJB_HPP
+
+#include <QObject>
+
+namespace subB {
+
+class ObjB : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp b/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
new file mode 100644
index 0000000..c2d94ef
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
@@ -0,0 +1,27 @@
+#include "SubObjC.hpp"
+
+namespace subC {
+
+class SubObjC : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjC() {}
+ ~SubObjC() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjC::aSlot()
+{
+}
+
+void ObjC::go()
+{
+ SubObjC subObj;
+}
+}
+
+#include "SubObjC.moc"
diff --git a/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp b/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
new file mode 100644
index 0000000..dc251fd
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
@@ -0,0 +1,16 @@
+#ifndef SUBOBJC_HPP
+#define SUBOBJC_HPP
+
+#include <QObject>
+
+namespace subC {
+
+class ObjC : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
new file mode 100644
index 0000000..6a0829d
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Test moc include patterns
+
+set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
+
+include_directories("../mocInclude")
+
+add_executable(mocIncludeRelaxed
+ ../mocInclude/ObjA.cpp
+ ../mocInclude/ObjB.cpp
+ ../mocInclude/ObjC.cpp
+ ../mocInclude/ObjD.cpp
+ ../mocInclude/subA/SubObjA.cpp
+ ../mocInclude/subB/SubObjB.cpp
+ ../mocInclude/subC/SubObjC.cpp
+ main.cpp
+)
+target_link_libraries(mocIncludeRelaxed ${QT_LIBRARIES})
+set_target_properties(mocIncludeRelaxed PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
new file mode 100644
index 0000000..142d59e
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
@@ -0,0 +1,14 @@
+#include "ObjA.hpp"
+#include "ObjB.hpp"
+#include "ObjC.hpp"
+
+int main(int argv, char** args)
+{
+ ObjA objA;
+ ObjB objB;
+ ObjC objC;
+ return 0;
+}
+
+// Header in global subdirectory
+#include "subB/moc_SubObjB.cpp"
diff --git a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
new file mode 100644
index 0000000..22e93a8
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Test moc include patterns
+
+set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
+
+include_directories("../mocInclude")
+
+add_executable(mocIncludeStrict
+ ../mocInclude/ObjA.cpp
+ ../mocInclude/ObjB.cpp
+ ../mocInclude/ObjC.cpp
+ ../mocInclude/ObjD.cpp
+ ../mocInclude/subA/SubObjA.cpp
+ ../mocInclude/subB/SubObjB.cpp
+ ../mocInclude/subC/SubObjC.cpp
+ main.cpp
+)
+target_link_libraries(mocIncludeStrict ${QT_LIBRARIES})
+set_target_properties(mocIncludeStrict PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocIncludeStrict/main.cpp b/Tests/QtAutogen/mocIncludeStrict/main.cpp
new file mode 100644
index 0000000..142d59e
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeStrict/main.cpp
@@ -0,0 +1,14 @@
+#include "ObjA.hpp"
+#include "ObjB.hpp"
+#include "ObjC.hpp"
+
+int main(int argv, char** args)
+{
+ ObjA objA;
+ ObjB objB;
+ ObjC objC;
+ return 0;
+}
+
+// Header in global subdirectory
+#include "subB/moc_SubObjB.cpp"