summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-10-25 18:24:42 +0200
committerBrad King <brad.king@kitware.com>2017-10-27 09:37:15 -0400
commit3a4db8617e42d47363309fa317d2cac2ee61a684 (patch)
tree447b029d444f9862f70f39997574e6926b152017 /Tests
parent798e4f2fad4013f1c759d66b42cfcd73d7dac428 (diff)
downloadcmake-3a4db8617e42d47363309fa317d2cac2ee61a684.tar.gz
Autogen: Tests: Add test for STATIC_LIBRARY cycles
Diffstat (limited to 'Tests')
-rw-r--r--Tests/QtAutogen/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt17
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/a.cpp7
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/a.h13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/b.cpp7
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/b.h13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/c.cpp7
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/c.h13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/main.cpp8
9 files changed, 89 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index ec35b89480..b9d8e46e49 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -214,5 +214,9 @@ add_subdirectory(objectLibrary)
add_subdirectory(sameName)
# -- Test
+# Tests static library cycles
+add_subdirectory(staticLibraryCycle)
+
+# -- Test
# Complex test case
add_subdirectory(complex)
diff --git a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt
new file mode 100644
index 0000000000..144a435f41
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Test AUTOMOC and AUTORCC on source files with the same name
+# but in different subdirectories
+
+set(CMAKE_AUTOMOC ON)
+
+# Cyclic static libraries
+add_library(slc_a STATIC a.cpp)
+target_link_libraries(slc_a ${QT_LIBRARIES} slc_b)
+
+add_library(slc_b STATIC b.cpp)
+target_link_libraries(slc_b ${QT_LIBRARIES} slc_c)
+
+add_library(slc_c STATIC c.cpp)
+target_link_libraries(slc_c ${QT_LIBRARIES} slc_a)
+
+add_executable(slc main.cpp)
+target_link_libraries(slc ${QT_LIBRARIES} slc_a)
diff --git a/Tests/QtAutogen/staticLibraryCycle/a.cpp b/Tests/QtAutogen/staticLibraryCycle/a.cpp
new file mode 100644
index 0000000000..97cc66e2d2
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/a.cpp
@@ -0,0 +1,7 @@
+#include "a.h"
+#include "b.h"
+
+A::A()
+{
+ B b;
+}
diff --git a/Tests/QtAutogen/staticLibraryCycle/a.h b/Tests/QtAutogen/staticLibraryCycle/a.h
new file mode 100644
index 0000000000..71761708bb
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/a.h
@@ -0,0 +1,13 @@
+#ifndef CLASSA_HPP
+#define CLASSA_HPP
+
+#include <QObject>
+
+class A : public QObject
+{
+ Q_OBJECT
+public:
+ A();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/b.cpp b/Tests/QtAutogen/staticLibraryCycle/b.cpp
new file mode 100644
index 0000000000..a807d89cfb
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/b.cpp
@@ -0,0 +1,7 @@
+#include "b.h"
+#include "c.h"
+
+B::B()
+{
+ C c;
+}
diff --git a/Tests/QtAutogen/staticLibraryCycle/b.h b/Tests/QtAutogen/staticLibraryCycle/b.h
new file mode 100644
index 0000000000..ededbd803b
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/b.h
@@ -0,0 +1,13 @@
+#ifndef CLASSB_HPP
+#define CLASSB_HPP
+
+#include <QObject>
+
+class B : public QObject
+{
+ Q_OBJECT
+public:
+ B();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/c.cpp b/Tests/QtAutogen/staticLibraryCycle/c.cpp
new file mode 100644
index 0000000000..7d427c234f
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/c.cpp
@@ -0,0 +1,7 @@
+#include "c.h"
+#include "a.h"
+
+C::C()
+{
+ A a;
+}
diff --git a/Tests/QtAutogen/staticLibraryCycle/c.h b/Tests/QtAutogen/staticLibraryCycle/c.h
new file mode 100644
index 0000000000..20f3725e93
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/c.h
@@ -0,0 +1,13 @@
+#ifndef CLASSC_HPP
+#define CLASSC_HPP
+
+#include <QObject>
+
+class C : public QObject
+{
+ Q_OBJECT
+public:
+ C();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/main.cpp b/Tests/QtAutogen/staticLibraryCycle/main.cpp
new file mode 100644
index 0000000000..f5b7fd227d
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/main.cpp
@@ -0,0 +1,8 @@
+#include "a.h"
+
+int main(int argv, char** args)
+{
+ // Object instances
+ A a;
+ return 0;
+}