diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-08-06 13:22:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-08-10 17:21:34 (GMT) |
commit | e4f508e42397549cd966e47349d4030cb793c354 (patch) | |
tree | 2d18a87082f3aa21b0f1115e9c54b07a21bac3dc | |
parent | 4e9b97d7397fd526e6b4e4ce43dd305cb8341ac8 (diff) | |
download | CMake-e4f508e42397549cd966e47349d4030cb793c354.zip CMake-e4f508e42397549cd966e47349d4030cb793c354.tar.gz CMake-e4f508e42397549cd966e47349d4030cb793c354.tar.bz2 |
Tests/QtAutogen: Test same moc/qrc source names in different directories
21 files changed, 237 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index d5aca55..e35e1d1 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(sameName) + 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/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt new file mode 100644 index 0000000..ed045fb --- /dev/null +++ b/Tests/QtAutogen/sameName/CMakeLists.txt @@ -0,0 +1,21 @@ +# Test AUTOMOC and AUTORCC on source files with the same name +# but in different subdirectories + +add_executable(sameName + 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 + item.cpp + data.qrc + main.cpp +) +target_include_directories(sameName PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(sameName ${QT_LIBRARIES}) +set_target_properties( sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE ) diff --git a/Tests/QtAutogen/sameName/aaa/bbb/data.qrc b/Tests/QtAutogen/sameName/aaa/bbb/data.qrc new file mode 100644 index 0000000..0ea3537 --- /dev/null +++ b/Tests/QtAutogen/sameName/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/sameName/aaa/bbb/item.cpp b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp new file mode 100644 index 0000000..20d0044 --- /dev/null +++ b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp @@ -0,0 +1,10 @@ +#include "item.hpp" + +namespace aaa { +namespace bbb { + +void Item::go() +{ +} +} +} diff --git a/Tests/QtAutogen/sameName/aaa/bbb/item.hpp b/Tests/QtAutogen/sameName/aaa/bbb/item.hpp new file mode 100644 index 0000000..0855043 --- /dev/null +++ b/Tests/QtAutogen/sameName/aaa/bbb/item.hpp @@ -0,0 +1,18 @@ +#ifndef AAA_BBB_ITEM_HPP +#define AAA_BBB_ITEM_HPP + +#include <QObject> + +namespace aaa { +namespace bbb { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} +} + +#endif diff --git a/Tests/QtAutogen/sameName/aaa/data.qrc b/Tests/QtAutogen/sameName/aaa/data.qrc new file mode 100644 index 0000000..379af60 --- /dev/null +++ b/Tests/QtAutogen/sameName/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/sameName/aaa/item.cpp b/Tests/QtAutogen/sameName/aaa/item.cpp new file mode 100644 index 0000000..95dd3b6 --- /dev/null +++ b/Tests/QtAutogen/sameName/aaa/item.cpp @@ -0,0 +1,8 @@ +#include "item.hpp" + +namespace aaa { + +void Item::go() +{ +} +} diff --git a/Tests/QtAutogen/sameName/aaa/item.hpp b/Tests/QtAutogen/sameName/aaa/item.hpp new file mode 100644 index 0000000..b63466f --- /dev/null +++ b/Tests/QtAutogen/sameName/aaa/item.hpp @@ -0,0 +1,16 @@ +#ifndef AAA_ITEM_HPP +#define AAA_ITEM_HPP + +#include <QObject> + +namespace aaa { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} + +#endif diff --git a/Tests/QtAutogen/sameName/bbb/aaa/data.qrc b/Tests/QtAutogen/sameName/bbb/aaa/data.qrc new file mode 100644 index 0000000..da98009 --- /dev/null +++ b/Tests/QtAutogen/sameName/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/sameName/bbb/aaa/item.cpp b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp new file mode 100644 index 0000000..ac4b2c2 --- /dev/null +++ b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp @@ -0,0 +1,10 @@ +#include "item.hpp" + +namespace bbb { +namespace aaa { + +void Item::go() +{ +} +} +} diff --git a/Tests/QtAutogen/sameName/bbb/aaa/item.hpp b/Tests/QtAutogen/sameName/bbb/aaa/item.hpp new file mode 100644 index 0000000..be07ca8 --- /dev/null +++ b/Tests/QtAutogen/sameName/bbb/aaa/item.hpp @@ -0,0 +1,18 @@ +#ifndef BBB_AAA_ITEM_HPP +#define BBB_AAA_ITEM_HPP + +#include <QObject> + +namespace bbb { +namespace aaa { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} +} + +#endif diff --git a/Tests/QtAutogen/sameName/bbb/data.qrc b/Tests/QtAutogen/sameName/bbb/data.qrc new file mode 100644 index 0000000..5b080f5 --- /dev/null +++ b/Tests/QtAutogen/sameName/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/sameName/bbb/item.cpp b/Tests/QtAutogen/sameName/bbb/item.cpp new file mode 100644 index 0000000..f97a143 --- /dev/null +++ b/Tests/QtAutogen/sameName/bbb/item.cpp @@ -0,0 +1,8 @@ +#include "item.hpp" + +namespace bbb { + +void Item::go() +{ +} +} diff --git a/Tests/QtAutogen/sameName/bbb/item.hpp b/Tests/QtAutogen/sameName/bbb/item.hpp new file mode 100644 index 0000000..5b7f985 --- /dev/null +++ b/Tests/QtAutogen/sameName/bbb/item.hpp @@ -0,0 +1,16 @@ +#ifndef BBB_ITEM_HPP +#define BBB_ITEM_HPP + +#include <QObject> + +namespace bbb { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} + +#endif diff --git a/Tests/QtAutogen/sameName/ccc/data.qrc b/Tests/QtAutogen/sameName/ccc/data.qrc new file mode 100644 index 0000000..f934c39 --- /dev/null +++ b/Tests/QtAutogen/sameName/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/sameName/ccc/item.cpp b/Tests/QtAutogen/sameName/ccc/item.cpp new file mode 100644 index 0000000..d90b2b8 --- /dev/null +++ b/Tests/QtAutogen/sameName/ccc/item.cpp @@ -0,0 +1,23 @@ +#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 "item.moc" +#include "moc_item.cpp" diff --git a/Tests/QtAutogen/sameName/ccc/item.hpp b/Tests/QtAutogen/sameName/ccc/item.hpp new file mode 100644 index 0000000..96fcc24 --- /dev/null +++ b/Tests/QtAutogen/sameName/ccc/item.hpp @@ -0,0 +1,16 @@ +#ifndef CCC_ITEM_HPP +#define CCC_ITEM_HPP + +#include <QObject> + +namespace ccc { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} + +#endif diff --git a/Tests/QtAutogen/sameName/data.qrc b/Tests/QtAutogen/sameName/data.qrc new file mode 100644 index 0000000..4ce0b4e --- /dev/null +++ b/Tests/QtAutogen/sameName/data.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>main.cpp</file> +</qresource> +</RCC> diff --git a/Tests/QtAutogen/sameName/item.cpp b/Tests/QtAutogen/sameName/item.cpp new file mode 100644 index 0000000..e013cf3 --- /dev/null +++ b/Tests/QtAutogen/sameName/item.cpp @@ -0,0 +1,5 @@ +#include "item.hpp" + +void Item::go() +{ +} diff --git a/Tests/QtAutogen/sameName/item.hpp b/Tests/QtAutogen/sameName/item.hpp new file mode 100644 index 0000000..91bba3b --- /dev/null +++ b/Tests/QtAutogen/sameName/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/sameName/main.cpp b/Tests/QtAutogen/sameName/main.cpp new file mode 100644 index 0000000..a4ffcb3 --- /dev/null +++ b/Tests/QtAutogen/sameName/main.cpp @@ -0,0 +1,16 @@ +#include "aaa/bbb/item.hpp" +#include "aaa/item.hpp" +#include "bbb/aaa/item.hpp" +#include "bbb/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; +} |