summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2016-04-13 16:36:39 (GMT)
committerBrad King <brad.king@kitware.com>2016-04-22 12:55:44 (GMT)
commit84946c735cc6d2b8f8e014f4772dd602b4a83a16 (patch)
treef89d262df1f4346f89c1c538dd90669c4d9810be /Tests
parent9c6fa684e7681417f5e75f25034f28212e22b229 (diff)
downloadCMake-84946c735cc6d2b8f8e014f4772dd602b4a83a16.zip
CMake-84946c735cc6d2b8f8e014f4772dd602b4a83a16.tar.gz
CMake-84946c735cc6d2b8f8e014f4772dd602b4a83a16.tar.bz2
Tests: QtAutogen: Same source name in different directories test
The test features multiple .cpp and .qrc files with the same name in different subdirectories. This requires AUTOMOC and AUTORCC to generate files with names that respect the path information of the source files.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/QtAutogen/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/same_name/CMakeLists.txt20
-rw-r--r--Tests/QtAutogen/same_name/aaa/bbb/data.qrc6
-rw-r--r--Tests/QtAutogen/same_name/aaa/bbb/item.cpp12
-rw-r--r--Tests/QtAutogen/same_name/aaa/bbb/item.hpp19
-rw-r--r--Tests/QtAutogen/same_name/aaa/data.qrc6
-rw-r--r--Tests/QtAutogen/same_name/aaa/item.cpp10
-rw-r--r--Tests/QtAutogen/same_name/aaa/item.hpp17
-rw-r--r--Tests/QtAutogen/same_name/bbb/aaa/data.qrc6
-rw-r--r--Tests/QtAutogen/same_name/bbb/aaa/item.cpp12
-rw-r--r--Tests/QtAutogen/same_name/bbb/aaa/item.hpp19
-rw-r--r--Tests/QtAutogen/same_name/bbb/data.qrc6
-rw-r--r--Tests/QtAutogen/same_name/bbb/item.cpp10
-rw-r--r--Tests/QtAutogen/same_name/bbb/item.hpp17
-rw-r--r--Tests/QtAutogen/same_name/ccc/data.qrc6
-rw-r--r--Tests/QtAutogen/same_name/ccc/item.cpp26
-rw-r--r--Tests/QtAutogen/same_name/ccc/item.hpp17
-rw-r--r--Tests/QtAutogen/same_name/data.qrc5
-rw-r--r--Tests/QtAutogen/same_name/main.cpp16
19 files changed, 234 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index d5aca55..4875165 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -110,6 +110,10 @@ set_target_properties(
AUTOMOC TRUE
)
+# Test AUTOMOC and AUTORCC on source files with the same name
+# but in different subdirectories
+add_subdirectory(same_name)
+
include(GenerateExportHeader)
# The order is relevant here. B depends on A, and B headers depend on A
# headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we
diff --git a/Tests/QtAutogen/same_name/CMakeLists.txt b/Tests/QtAutogen/same_name/CMakeLists.txt
new file mode 100644
index 0000000..54bf048
--- /dev/null
+++ b/Tests/QtAutogen/same_name/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Test AUTOMOC and AUTORCC on source files with the same name
+# but in different subdirectories
+
+add_executable(same_name
+ aaa/bbb/item.cpp
+ aaa/bbb/data.qrc
+ aaa/item.cpp
+ aaa/data.qrc
+ bbb/aaa/item.cpp
+ bbb/aaa/data.qrc
+ bbb/item.cpp
+ bbb/data.qrc
+ ccc/item.cpp
+ ccc/data.qrc
+ main.cpp
+ data.qrc
+)
+target_include_directories(same_name PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries(same_name ${QT_LIBRARIES})
+set_target_properties( same_name PROPERTIES AUTOMOC TRUE AUTORCC TRUE )
diff --git a/Tests/QtAutogen/same_name/aaa/bbb/data.qrc b/Tests/QtAutogen/same_name/aaa/bbb/data.qrc
new file mode 100644
index 0000000..0ea3537
--- /dev/null
+++ b/Tests/QtAutogen/same_name/aaa/bbb/data.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="aaa/bbb">
+ <file>item.hpp</file>
+ <file>item.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/same_name/aaa/bbb/item.cpp b/Tests/QtAutogen/same_name/aaa/bbb/item.cpp
new file mode 100644
index 0000000..d715116
--- /dev/null
+++ b/Tests/QtAutogen/same_name/aaa/bbb/item.cpp
@@ -0,0 +1,12 @@
+#include "item.hpp"
+
+namespace aaa {
+namespace bbb {
+
+void
+Item::go ( )
+{
+}
+
+}
+}
diff --git a/Tests/QtAutogen/same_name/aaa/bbb/item.hpp b/Tests/QtAutogen/same_name/aaa/bbb/item.hpp
new file mode 100644
index 0000000..c82309d
--- /dev/null
+++ b/Tests/QtAutogen/same_name/aaa/bbb/item.hpp
@@ -0,0 +1,19 @@
+#ifndef SDA_SDB_ITEM_HPP
+#define SDA_SDB_ITEM_HPP
+
+#include <QObject>
+
+namespace aaa {
+namespace bbb {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+}
+
+#endif
diff --git a/Tests/QtAutogen/same_name/aaa/data.qrc b/Tests/QtAutogen/same_name/aaa/data.qrc
new file mode 100644
index 0000000..379af60
--- /dev/null
+++ b/Tests/QtAutogen/same_name/aaa/data.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="aaa/">
+ <file>item.hpp</file>
+ <file>item.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/same_name/aaa/item.cpp b/Tests/QtAutogen/same_name/aaa/item.cpp
new file mode 100644
index 0000000..7887d76
--- /dev/null
+++ b/Tests/QtAutogen/same_name/aaa/item.cpp
@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace aaa {
+
+void
+Item::go ( )
+{
+}
+
+}
diff --git a/Tests/QtAutogen/same_name/aaa/item.hpp b/Tests/QtAutogen/same_name/aaa/item.hpp
new file mode 100644
index 0000000..3c24275
--- /dev/null
+++ b/Tests/QtAutogen/same_name/aaa/item.hpp
@@ -0,0 +1,17 @@
+#ifndef SDA_ITEM_HPP
+#define SDA_ITEM_HPP
+
+#include <QObject>
+
+namespace aaa {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
diff --git a/Tests/QtAutogen/same_name/bbb/aaa/data.qrc b/Tests/QtAutogen/same_name/bbb/aaa/data.qrc
new file mode 100644
index 0000000..da98009
--- /dev/null
+++ b/Tests/QtAutogen/same_name/bbb/aaa/data.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="bbb/aaa/">
+ <file>item.hpp</file>
+ <file>item.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/same_name/bbb/aaa/item.cpp b/Tests/QtAutogen/same_name/bbb/aaa/item.cpp
new file mode 100644
index 0000000..36d5b6d
--- /dev/null
+++ b/Tests/QtAutogen/same_name/bbb/aaa/item.cpp
@@ -0,0 +1,12 @@
+#include "item.hpp"
+
+namespace bbb {
+namespace aaa {
+
+void
+Item::go ( )
+{
+}
+
+}
+}
diff --git a/Tests/QtAutogen/same_name/bbb/aaa/item.hpp b/Tests/QtAutogen/same_name/bbb/aaa/item.hpp
new file mode 100644
index 0000000..35a3686
--- /dev/null
+++ b/Tests/QtAutogen/same_name/bbb/aaa/item.hpp
@@ -0,0 +1,19 @@
+#ifndef SDB_SDA_ITEM_HPP
+#define SDB_SDA_ITEM_HPP
+
+#include <QObject>
+
+namespace bbb {
+namespace aaa {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+}
+
+#endif
diff --git a/Tests/QtAutogen/same_name/bbb/data.qrc b/Tests/QtAutogen/same_name/bbb/data.qrc
new file mode 100644
index 0000000..5b080f5
--- /dev/null
+++ b/Tests/QtAutogen/same_name/bbb/data.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="bbb/">
+ <file>item.hpp</file>
+ <file>item.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/same_name/bbb/item.cpp b/Tests/QtAutogen/same_name/bbb/item.cpp
new file mode 100644
index 0000000..064295b
--- /dev/null
+++ b/Tests/QtAutogen/same_name/bbb/item.cpp
@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace bbb {
+
+void
+Item::go ( )
+{
+}
+
+}
diff --git a/Tests/QtAutogen/same_name/bbb/item.hpp b/Tests/QtAutogen/same_name/bbb/item.hpp
new file mode 100644
index 0000000..eda84a2
--- /dev/null
+++ b/Tests/QtAutogen/same_name/bbb/item.hpp
@@ -0,0 +1,17 @@
+#ifndef SDB_ITEM_HPP
+#define SDB_ITEM_HPP
+
+#include <QObject>
+
+namespace bbb {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
diff --git a/Tests/QtAutogen/same_name/ccc/data.qrc b/Tests/QtAutogen/same_name/ccc/data.qrc
new file mode 100644
index 0000000..f934c39
--- /dev/null
+++ b/Tests/QtAutogen/same_name/ccc/data.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="ccc/">
+ <file>item.hpp</file>
+ <file>item.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/same_name/ccc/item.cpp b/Tests/QtAutogen/same_name/ccc/item.cpp
new file mode 100644
index 0000000..2584881
--- /dev/null
+++ b/Tests/QtAutogen/same_name/ccc/item.cpp
@@ -0,0 +1,26 @@
+#include "item.hpp"
+
+namespace ccc {
+
+void
+Item::go ( )
+{
+}
+
+class MocTest : public QObject
+{
+ Q_OBJECT;
+ Q_SLOT
+ void go ( );
+};
+
+void
+MocTest::go()
+{
+}
+
+}
+
+// Include own moc files
+#include "moc_item.cpp"
+#include "item.moc"
diff --git a/Tests/QtAutogen/same_name/ccc/item.hpp b/Tests/QtAutogen/same_name/ccc/item.hpp
new file mode 100644
index 0000000..6386dc6
--- /dev/null
+++ b/Tests/QtAutogen/same_name/ccc/item.hpp
@@ -0,0 +1,17 @@
+#ifndef SDC_ITEM_HPP
+#define SDC_ITEM_HPP
+
+#include <QObject>
+
+namespace ccc {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
diff --git a/Tests/QtAutogen/same_name/data.qrc b/Tests/QtAutogen/same_name/data.qrc
new file mode 100644
index 0000000..4ce0b4e
--- /dev/null
+++ b/Tests/QtAutogen/same_name/data.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>main.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/same_name/main.cpp b/Tests/QtAutogen/same_name/main.cpp
new file mode 100644
index 0000000..166466e
--- /dev/null
+++ b/Tests/QtAutogen/same_name/main.cpp
@@ -0,0 +1,16 @@
+#include "aaa/item.hpp"
+#include "aaa/bbb/item.hpp"
+#include "bbb/item.hpp"
+#include "bbb/aaa/item.hpp"
+#include "ccc/item.hpp"
+
+int main(int argv, char **args)
+{
+ // Object instances
+ ::aaa::Item aaa_item;
+ ::aaa::bbb::Item aaa_bbb_item;
+ ::bbb::Item bbb_item;
+ ::bbb::aaa::Item bbb_aaa_item;
+ ::ccc::Item ccc_item;
+ return 0;
+}