summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-08-10 17:16:16 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-08-10 21:15:48 (GMT)
commit15ef27286ade97a49f6832254d3451755a824fb8 (patch)
tree5c37dab5bfe7817f9ce9738e93394cefffac0fb8
parent362f9bd755c7b964184db38d1fb2217ded70af63 (diff)
downloadCMake-15ef27286ade97a49f6832254d3451755a824fb8.zip
CMake-15ef27286ade97a49f6832254d3451755a824fb8.tar.gz
CMake-15ef27286ade97a49f6832254d3451755a824fb8.tar.bz2
Autogen: Add test for OBJECT libraries
-rw-r--r--Tests/QtAutogen/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/objectLibrary/CMakeLists.txt14
-rw-r--r--Tests/QtAutogen/objectLibrary/a/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/objectLibrary/a/classa.cpp7
-rw-r--r--Tests/QtAutogen/objectLibrary/a/classa.h23
-rw-r--r--Tests/QtAutogen/objectLibrary/b/classb.cpp7
-rw-r--r--Tests/QtAutogen/objectLibrary/b/classb.h23
-rw-r--r--Tests/QtAutogen/objectLibrary/main.cpp13
8 files changed, 93 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 5064d26..198bf63 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -193,5 +193,9 @@ endif()
add_subdirectory(uicInclude)
# -- Test
+# OBJECT libraries
+add_subdirectory(objectLibrary)
+
+# -- Test
# Complex test case
add_subdirectory(complex)
diff --git a/Tests/QtAutogen/objectLibrary/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/CMakeLists.txt
new file mode 100644
index 0000000..9b29a40
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/CMakeLists.txt
@@ -0,0 +1,14 @@
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+
+# Object library a defined in a subdirectory
+add_subdirectory(a)
+
+# Object library b defined locally
+include_directories(b)
+add_library(b OBJECT b/classb.cpp)
+target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES})
+
+# Executable with OBJECT library generator expressions
+add_executable(someProgram main.cpp $<TARGET_OBJECTS:a> $<TARGET_OBJECTS:b>)
+target_link_libraries(someProgram ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt
new file mode 100644
index 0000000..fe76ac3
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(a OBJECT classa.cpp)
+target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES})
diff --git a/Tests/QtAutogen/objectLibrary/a/classa.cpp b/Tests/QtAutogen/objectLibrary/a/classa.cpp
new file mode 100644
index 0000000..4f08fda
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/a/classa.cpp
@@ -0,0 +1,7 @@
+#include "classa.h"
+#include <QDebug>
+
+void ClassA::slotDoSomething()
+{
+ qDebug() << m_member;
+}
diff --git a/Tests/QtAutogen/objectLibrary/a/classa.h b/Tests/QtAutogen/objectLibrary/a/classa.h
new file mode 100644
index 0000000..fa5fed9
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/a/classa.h
@@ -0,0 +1,23 @@
+#ifndef CLASSA_H
+#define CLASSA_H
+
+#include <QObject>
+#include <QString>
+
+class ClassA : public QObject
+{
+ Q_OBJECT
+public:
+ ClassA()
+ : m_member("Hello A")
+ {
+ }
+
+public slots:
+ void slotDoSomething();
+
+private:
+ QString m_member;
+};
+
+#endif
diff --git a/Tests/QtAutogen/objectLibrary/b/classb.cpp b/Tests/QtAutogen/objectLibrary/b/classb.cpp
new file mode 100644
index 0000000..26e0926
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/b/classb.cpp
@@ -0,0 +1,7 @@
+#include "classb.h"
+#include <QDebug>
+
+void ClassB::slotDoSomething()
+{
+ qDebug() << m_member;
+}
diff --git a/Tests/QtAutogen/objectLibrary/b/classb.h b/Tests/QtAutogen/objectLibrary/b/classb.h
new file mode 100644
index 0000000..783bb48
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/b/classb.h
@@ -0,0 +1,23 @@
+#ifndef CLASSB_H
+#define CLASSB_H
+
+#include <QObject>
+#include <QString>
+
+class ClassB : public QObject
+{
+ Q_OBJECT
+public:
+ ClassB()
+ : m_member("Hello B")
+ {
+ }
+
+public slots:
+ void slotDoSomething();
+
+private:
+ QString m_member;
+};
+
+#endif
diff --git a/Tests/QtAutogen/objectLibrary/main.cpp b/Tests/QtAutogen/objectLibrary/main.cpp
new file mode 100644
index 0000000..cacf0fd
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/main.cpp
@@ -0,0 +1,13 @@
+#include "a/classa.h"
+#include "b/classb.h"
+
+int main(int argc, char** argv)
+{
+ ClassA a;
+ a.slotDoSomething();
+
+ ClassB b;
+ b.slotDoSomething();
+
+ return 0;
+}