diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-08 16:29:23 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-13 12:48:27 (GMT) |
commit | 0b8597a86ee8bed2c34f52d309fd57b5f29a1595 (patch) | |
tree | 912e41e02cc0e562fca2caa9897e1e850359611b /Tests/QtAutogen | |
parent | 227a7974f426e0966d1736c66dd606b068985d1b (diff) | |
download | CMake-0b8597a86ee8bed2c34f52d309fd57b5f29a1595.zip CMake-0b8597a86ee8bed2c34f52d309fd57b5f29a1595.tar.gz CMake-0b8597a86ee8bed2c34f52d309fd57b5f29a1595.tar.bz2 |
Autogen: Tests: Separate mocOnly and mocOnlyOpts tests
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/QtAutogen/CommonTests.cmake | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOnly/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOnly/StyleA.cpp (renamed from Tests/QtAutogen/mocOnlySource/StyleA.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOnly/StyleA.hpp (renamed from Tests/QtAutogen/mocOnlySource/StyleA.hpp) | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOnly/StyleB.cpp (renamed from Tests/QtAutogen/mocOnlySource/StyleB.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOnly/StyleB.hpp (renamed from Tests/QtAutogen/mocOnlySource/StyleB.hpp) | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOnly/main.cpp (renamed from Tests/QtAutogen/mocOnlySource/main.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions/Object.cpp | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions/Object.hpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions/main.cpp | 7 | ||||
-rw-r--r-- | Tests/QtAutogen/TestMacros.cmake | 7 |
13 files changed, 50 insertions, 16 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index dff9d0c..160903a 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,17 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# MOC only -add_executable(mocOnly mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp) -set_property(TARGET mocOnly PROPERTY AUTOMOC ON) -target_link_libraries(mocOnly ${QT_LIBRARIES}) - -add_executable(mocOnlyOpts mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp) -set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC ON) -set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC_MOC_OPTIONS "-nw") -target_link_libraries(mocOnlyOpts ${QT_LIBRARIES}) - -# -- Test # UIC only if(ALLOW_WRAP_CPP) qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 0eaf831..5abbee5 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -1 +1,3 @@ # Autogen tests common for Qt4 and Qt5 +ADD_AUTOGEN_TEST(MocOnly mocOnly) +ADD_AUTOGEN_TEST(MocOptions mocOptions) diff --git a/Tests/QtAutogen/MocOnly/CMakeLists.txt b/Tests/QtAutogen/MocOnly/CMakeLists.txt new file mode 100644 index 0000000..33feadf --- /dev/null +++ b/Tests/QtAutogen/MocOnly/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(MocOnly) +include("../AutogenTest.cmake") + +# Test different Q_OBJECT position styles +add_executable(mocOnly StyleA.cpp StyleB.cpp main.cpp) +set_property(TARGET mocOnly PROPERTY AUTOMOC ON) +target_link_libraries(mocOnly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.cpp b/Tests/QtAutogen/MocOnly/StyleA.cpp index ced1dd1..ced1dd1 100644 --- a/Tests/QtAutogen/mocOnlySource/StyleA.cpp +++ b/Tests/QtAutogen/MocOnly/StyleA.cpp diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.hpp b/Tests/QtAutogen/MocOnly/StyleA.hpp index 66735b6..5ba0a87 100644 --- a/Tests/QtAutogen/mocOnlySource/StyleA.hpp +++ b/Tests/QtAutogen/MocOnly/StyleA.hpp @@ -3,6 +3,7 @@ #include <QObject> +/* clang-format off */ /// Q_OBJECT on a single new line /// class StyleA : public QObject @@ -11,5 +12,6 @@ class StyleA : public QObject public: StyleA(); }; +/* clang-format on */ #endif diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.cpp b/Tests/QtAutogen/MocOnly/StyleB.cpp index bec6c1c..bec6c1c 100644 --- a/Tests/QtAutogen/mocOnlySource/StyleB.cpp +++ b/Tests/QtAutogen/MocOnly/StyleB.cpp diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.hpp b/Tests/QtAutogen/MocOnly/StyleB.hpp index 425daf8..86abaa8 100644 --- a/Tests/QtAutogen/mocOnlySource/StyleB.hpp +++ b/Tests/QtAutogen/MocOnly/StyleB.hpp @@ -4,7 +4,7 @@ #include <QObject> /* clang-format off */ -/// Q_OBJECT behind a brace +/// Q_OBJECT behind a brace on a new line /// class StyleB : public QObject { Q_OBJECT diff --git a/Tests/QtAutogen/mocOnlySource/main.cpp b/Tests/QtAutogen/MocOnly/main.cpp index 06f8d81..06f8d81 100644 --- a/Tests/QtAutogen/mocOnlySource/main.cpp +++ b/Tests/QtAutogen/MocOnly/main.cpp diff --git a/Tests/QtAutogen/MocOptions/CMakeLists.txt b/Tests/QtAutogen/MocOptions/CMakeLists.txt new file mode 100644 index 0000000..f64b37b --- /dev/null +++ b/Tests/QtAutogen/MocOptions/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.10) +project(MocOptions) +include("../AutogenTest.cmake") + +# Test extra options passed to moc via AUTOMOC_MOC_OPTIONS +add_executable(mocOptions Object.cpp main.cpp) +set_property(TARGET mocOptions PROPERTY AUTOMOC ON) +set_property(TARGET mocOptions PROPERTY AUTOMOC_MOC_OPTIONS "-nw") +target_link_libraries(mocOptions ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocOptions/Object.cpp b/Tests/QtAutogen/MocOptions/Object.cpp new file mode 100644 index 0000000..ad109f1 --- /dev/null +++ b/Tests/QtAutogen/MocOptions/Object.cpp @@ -0,0 +1,5 @@ +#include "Object.hpp" + +Object::Object() +{ +} diff --git a/Tests/QtAutogen/MocOptions/Object.hpp b/Tests/QtAutogen/MocOptions/Object.hpp new file mode 100644 index 0000000..e7a6142 --- /dev/null +++ b/Tests/QtAutogen/MocOptions/Object.hpp @@ -0,0 +1,13 @@ +#ifndef Object_HPP +#define Object_HPP + +#include <QObject> + +class Object : public QObject +{ + Q_OBJECT +public: + Object(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOptions/main.cpp b/Tests/QtAutogen/MocOptions/main.cpp new file mode 100644 index 0000000..7aeab1a --- /dev/null +++ b/Tests/QtAutogen/MocOptions/main.cpp @@ -0,0 +1,7 @@ +#include "Object.hpp" + +int main(int argv, char** args) +{ + Object object; + return 0; +} diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake index 849a733..966f3b8 100644 --- a/Tests/QtAutogen/TestMacros.cmake +++ b/Tests/QtAutogen/TestMacros.cmake @@ -41,9 +41,8 @@ macro(ADD_AUTOGEN_TEST NAME) unset(_BuildDir) endmacro() - # Allow using qtx_wrap_cpp and qtx_generate_moc or not -set(ALLOW_WRAP_CPP TRUE) +set(QT_TEST_ALLOW_QT_MACROS TRUE) # Do a simple check if there is are non ASCII character in the build path string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR}) if(NON_ASCII_BDIR) @@ -51,11 +50,11 @@ if(NON_ASCII_BDIR) # qtx_wrap_cpp # https://bugreports.qt.io/browse/QTBUG-35480 if(QT_TEST_VERSION STREQUAL 4) - set(ALLOW_WRAP_CPP FALSE) + set(QT_TEST_ALLOW_QT_MACROS FALSE) endif() # On windows qtx_wrap_cpp also fails in Qt5 when used on a path that # contains non ASCII characters if(WIN32) - set(ALLOW_WRAP_CPP FALSE) + set(QT_TEST_ALLOW_QT_MACROS FALSE) endif() endif() |