Am 13.04.2016 um 16:40 schrieb Brad King:
On 04/13/2016 10:08 AM, Sebastian Holtermann wrote:
Well, looking into the sources and there is already Tests/QtAutogen.
It covers various #include "moc_..." cases.
Perhaps, but as pointed out in the issue tracker entry I linked those
test cases were not sufficient to fail after the the incorrect fix
made and reverted there. Please identify why and extend them.
Here is a patch that introduces the same-source-name test
in Tests/QtAutogen.
With the current git cmake the test fails.
The latest moc-directory-patch from earlier in this thread
(cmake_automoc_directory_fix-2016-04-12-3.patch)
fixes the issue.
-Sebastian
>From 3e8b56da1d10defa471bd8fa1f30393c16ad5745 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann <[email protected]>
Date: Wed, 13 Apr 2016 20:05:04 +0200
Subject: [PATCH] Tests/QtAutogen: New Same source name in different
directories test
---
Tests/QtAutogen/CMakeLists.txt | 19 +++++++++++++++++++
Tests/QtAutogen/item.cpp | 10 ++++++++++
Tests/QtAutogen/item.hpp | 17 +++++++++++++++++
Tests/QtAutogen/sname.cpp | 20 ++++++++++++++++++++
Tests/QtAutogen/sname/item.cpp | 6 ++++++
Tests/QtAutogen/sname/item.hpp | 13 +++++++++++++
Tests/QtAutogen/sname/sdA/item.cpp | 10 ++++++++++
Tests/QtAutogen/sname/sdA/item.hpp | 17 +++++++++++++++++
Tests/QtAutogen/sname/sdA/sdB/item.cpp | 12 ++++++++++++
Tests/QtAutogen/sname/sdA/sdB/item.hpp | 19 +++++++++++++++++++
Tests/QtAutogen/sname/sdB/item.cpp | 10 ++++++++++
Tests/QtAutogen/sname/sdB/item.hpp | 17 +++++++++++++++++
Tests/QtAutogen/sname/sdB/sdA/item.cpp | 12 ++++++++++++
Tests/QtAutogen/sname/sdB/sdA/item.hpp | 19 +++++++++++++++++++
Tests/QtAutogen/sname/sdC/item.cpp | 13 +++++++++++++
Tests/QtAutogen/sname/sdC/item.hpp | 17 +++++++++++++++++
16 files changed, 231 insertions(+)
create mode 100644 Tests/QtAutogen/item.cpp
create mode 100644 Tests/QtAutogen/item.hpp
create mode 100644 Tests/QtAutogen/sname.cpp
create mode 100644 Tests/QtAutogen/sname/item.cpp
create mode 100644 Tests/QtAutogen/sname/item.hpp
create mode 100644 Tests/QtAutogen/sname/sdA/item.cpp
create mode 100644 Tests/QtAutogen/sname/sdA/item.hpp
create mode 100644 Tests/QtAutogen/sname/sdA/sdB/item.cpp
create mode 100644 Tests/QtAutogen/sname/sdA/sdB/item.hpp
create mode 100644 Tests/QtAutogen/sname/sdB/item.cpp
create mode 100644 Tests/QtAutogen/sname/sdB/item.hpp
create mode 100644 Tests/QtAutogen/sname/sdB/sdA/item.cpp
create mode 100644 Tests/QtAutogen/sname/sdB/sdA/item.hpp
create mode 100644 Tests/QtAutogen/sname/sdC/item.cpp
create mode 100644 Tests/QtAutogen/sname/sdC/item.hpp
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index d5aca55..7aad28b 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -110,6 +110,25 @@ set_target_properties(
AUTOMOC TRUE
)
+# Test AUTOMOC on source files with the same name but in different directories
+add_executable(same_name
+ sname/sdA/sdB/item.cpp
+ sname/sdA/item.cpp
+ sname/sdB/sdA/item.cpp
+ sname/sdB/item.cpp
+ sname/sdC/item.cpp
+ sname/item.cpp
+ item.cpp
+ sname.cpp
+ )
+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
+)
+
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/item.cpp b/Tests/QtAutogen/item.cpp
new file mode 100644
index 0000000..0c96f34
--- /dev/null
+++ b/Tests/QtAutogen/item.cpp
@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace root {
+
+void
+Item::go ( )
+{
+}
+
+}
diff --git a/Tests/QtAutogen/item.hpp b/Tests/QtAutogen/item.hpp
new file mode 100644
index 0000000..bda4bb0
--- /dev/null
+++ b/Tests/QtAutogen/item.hpp
@@ -0,0 +1,17 @@
+#ifndef ROOT_ITEM_HPP
+#define ROOT_ITEM_HPP
+
+#include <QObject>
+
+namespace root {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
diff --git a/Tests/QtAutogen/sname.cpp b/Tests/QtAutogen/sname.cpp
new file mode 100644
index 0000000..fd125f9
--- /dev/null
+++ b/Tests/QtAutogen/sname.cpp
@@ -0,0 +1,20 @@
+#include "item.hpp"
+#include "sname/item.hpp"
+#include "sname/sdA/item.hpp"
+#include "sname/sdA/sdB/item.hpp"
+#include "sname/sdB/item.hpp"
+#include "sname/sdB/sdA/item.hpp"
+#include "sname/sdC/item.hpp"
+
+int main(int argv, char **args)
+{
+ // Object instances
+ ::root::Item ritem;
+ Item item;
+ ::sdA::Item itemA;
+ ::sdA::sdB::Item itemAB;
+ ::sdB::Item itemB;
+ ::sdB::sdA::Item itemBA;
+ ::sdC::Item itemC;
+ return 0;
+}
diff --git a/Tests/QtAutogen/sname/item.cpp b/Tests/QtAutogen/sname/item.cpp
new file mode 100644
index 0000000..508f6a6
--- /dev/null
+++ b/Tests/QtAutogen/sname/item.cpp
@@ -0,0 +1,6 @@
+#include "item.hpp"
+
+void
+Item::go ( )
+{
+}
\ No newline at end of file
diff --git a/Tests/QtAutogen/sname/item.hpp b/Tests/QtAutogen/sname/item.hpp
new file mode 100644
index 0000000..49c38cd
--- /dev/null
+++ b/Tests/QtAutogen/sname/item.hpp
@@ -0,0 +1,13 @@
+#ifndef ITEM_HPP
+#define ITEM_HPP
+
+#include <QObject>
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+#endif
diff --git a/Tests/QtAutogen/sname/sdA/item.cpp b/Tests/QtAutogen/sname/sdA/item.cpp
new file mode 100644
index 0000000..a1c184d
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdA/item.cpp
@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace sdA {
+
+void
+Item::go ( )
+{
+}
+
+}
diff --git a/Tests/QtAutogen/sname/sdA/item.hpp b/Tests/QtAutogen/sname/sdA/item.hpp
new file mode 100644
index 0000000..3bd67ed
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdA/item.hpp
@@ -0,0 +1,17 @@
+#ifndef SDA_ITEM_HPP
+#define SDA_ITEM_HPP
+
+#include <QObject>
+
+namespace sdA {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
diff --git a/Tests/QtAutogen/sname/sdA/sdB/item.cpp b/Tests/QtAutogen/sname/sdA/sdB/item.cpp
new file mode 100644
index 0000000..262a351
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdA/sdB/item.cpp
@@ -0,0 +1,12 @@
+#include "item.hpp"
+
+namespace sdA {
+namespace sdB {
+
+void
+Item::go ( )
+{
+}
+
+}
+}
diff --git a/Tests/QtAutogen/sname/sdA/sdB/item.hpp b/Tests/QtAutogen/sname/sdA/sdB/item.hpp
new file mode 100644
index 0000000..74d1cc1
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdA/sdB/item.hpp
@@ -0,0 +1,19 @@
+#ifndef SDA_SDB_ITEM_HPP
+#define SDA_SDB_ITEM_HPP
+
+#include <QObject>
+
+namespace sdA {
+namespace sdB {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+}
+
+#endif
diff --git a/Tests/QtAutogen/sname/sdB/item.cpp b/Tests/QtAutogen/sname/sdB/item.cpp
new file mode 100644
index 0000000..2936727
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdB/item.cpp
@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace sdB {
+
+void
+Item::go ( )
+{
+}
+
+}
diff --git a/Tests/QtAutogen/sname/sdB/item.hpp b/Tests/QtAutogen/sname/sdB/item.hpp
new file mode 100644
index 0000000..aa14b7a
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdB/item.hpp
@@ -0,0 +1,17 @@
+#ifndef SDB_ITEM_HPP
+#define SDB_ITEM_HPP
+
+#include <QObject>
+
+namespace sdB {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
diff --git a/Tests/QtAutogen/sname/sdB/sdA/item.cpp b/Tests/QtAutogen/sname/sdB/sdA/item.cpp
new file mode 100644
index 0000000..e967662
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdB/sdA/item.cpp
@@ -0,0 +1,12 @@
+#include "item.hpp"
+
+namespace sdB {
+namespace sdA {
+
+void
+Item::go ( )
+{
+}
+
+}
+}
diff --git a/Tests/QtAutogen/sname/sdB/sdA/item.hpp b/Tests/QtAutogen/sname/sdB/sdA/item.hpp
new file mode 100644
index 0000000..69985c4
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdB/sdA/item.hpp
@@ -0,0 +1,19 @@
+#ifndef SDB_SDA_ITEM_HPP
+#define SDB_SDA_ITEM_HPP
+
+#include <QObject>
+
+namespace sdB {
+namespace sdA {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+}
+
+#endif
diff --git a/Tests/QtAutogen/sname/sdC/item.cpp b/Tests/QtAutogen/sname/sdC/item.cpp
new file mode 100644
index 0000000..4a66fd9
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdC/item.cpp
@@ -0,0 +1,13 @@
+#include "item.hpp"
+
+namespace sdC {
+
+void
+Item::go ( )
+{
+}
+
+}
+
+// Include own moc
+#include "moc_item.cpp"
diff --git a/Tests/QtAutogen/sname/sdC/item.hpp b/Tests/QtAutogen/sname/sdC/item.hpp
new file mode 100644
index 0000000..8ca60a5
--- /dev/null
+++ b/Tests/QtAutogen/sname/sdC/item.hpp
@@ -0,0 +1,17 @@
+#ifndef SDC_ITEM_HPP
+#define SDC_ITEM_HPP
+
+#include <QObject>
+
+namespace sdC {
+
+class Item : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go ( );
+};
+
+}
+
+#endif
--
2.8.0.rc3
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers