diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-08 18:15:26 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-13 12:48:28 (GMT) |
commit | fb7e52ca3d920ca1de8b2abb23da3d83db988eca (patch) | |
tree | 5115b6cc960afe715352af9985186fc94eebbdce /Tests/QtAutogen/MocMacroName | |
parent | 5cab8c307c7df585152e3ab9e007574cb0e690dc (diff) | |
download | CMake-fb7e52ca3d920ca1de8b2abb23da3d83db988eca.zip CMake-fb7e52ca3d920ca1de8b2abb23da3d83db988eca.tar.gz CMake-fb7e52ca3d920ca1de8b2abb23da3d83db988eca.tar.bz2 |
Autogen: Tests: Separate MocMacroName test
Diffstat (limited to 'Tests/QtAutogen/MocMacroName')
-rw-r--r-- | Tests/QtAutogen/MocMacroName/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/CustomMacros.hpp | 8 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Gadget.cpp | 6 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Gadget.hpp | 19 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Object.cpp | 10 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Object.hpp | 22 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Object1Aliased.cpp | 9 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Object1Aliased.hpp | 20 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Object2Aliased.cpp | 9 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/Object2Aliased.hpp | 20 | ||||
-rw-r--r-- | Tests/QtAutogen/MocMacroName/main.cpp | 13 |
11 files changed, 153 insertions, 0 deletions
diff --git a/Tests/QtAutogen/MocMacroName/CMakeLists.txt b/Tests/QtAutogen/MocMacroName/CMakeLists.txt new file mode 100644 index 0000000..f0251a2 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(MocMacroName) +include("../AutogenTest.cmake") + +# Test CMAKE_AUTOMOC_MACRO_NAMES and AUTOMOC_MACRO_NAMES +list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS") + +add_executable(mocMacroName + main.cpp + Gadget.cpp + Object.cpp + Object1Aliased.cpp + Object2Aliased.cpp +) +set_property(TARGET mocMacroName PROPERTY AUTOMOC ON) +set_property(TARGET mocMacroName APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS") +target_link_libraries(mocMacroName ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocMacroName/CustomMacros.hpp b/Tests/QtAutogen/MocMacroName/CustomMacros.hpp new file mode 100644 index 0000000..93e5bfd --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/CustomMacros.hpp @@ -0,0 +1,8 @@ +#ifndef CUSTOM_MACROS_HPP +#define CUSTOM_MACROS_HPP + +#include <QObject> +#define QO1_ALIAS Q_OBJECT +#define QO2_ALIAS Q_OBJECT + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Gadget.cpp b/Tests/QtAutogen/MocMacroName/Gadget.cpp new file mode 100644 index 0000000..d7cb515 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Gadget.cpp @@ -0,0 +1,6 @@ +#include "Gadget.hpp" + +Gadget::Gadget() + : _test(0) +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Gadget.hpp b/Tests/QtAutogen/MocMacroName/Gadget.hpp new file mode 100644 index 0000000..cab792e --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Gadget.hpp @@ -0,0 +1,19 @@ +#ifndef GADGET_HPP +#define GADGET_HPP + +#include <QMetaType> + +class Gadget +{ + Q_GADGET + Q_PROPERTY(int test READ getTest) +public: + Gadget(); + + int getTest() { return _test; } + +private: + int _test; +}; + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Object.cpp b/Tests/QtAutogen/MocMacroName/Object.cpp new file mode 100644 index 0000000..800ebf3 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object.cpp @@ -0,0 +1,10 @@ +#include "Object.hpp" + +Object::Object() + : _test(0) +{ +} + +void Object::aSlot() +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Object.hpp b/Tests/QtAutogen/MocMacroName/Object.hpp new file mode 100644 index 0000000..aadae1f --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object.hpp @@ -0,0 +1,22 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include <QObject> + +class Object : public QObject +{ + Q_OBJECT + Q_PROPERTY(int test READ getTest) +public: + Object(); + + int getTest() { return _test; } + + Q_SLOT + void aSlot(); + +private: + int _test; +}; + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/MocMacroName/Object1Aliased.cpp new file mode 100644 index 0000000..b8b4806 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object1Aliased.cpp @@ -0,0 +1,9 @@ +#include "Object1Aliased.hpp" + +Object1Aliased::Object1Aliased() +{ +} + +void Object1Aliased::aSlot() +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/MocMacroName/Object1Aliased.hpp new file mode 100644 index 0000000..6c6bb40 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object1Aliased.hpp @@ -0,0 +1,20 @@ +#ifndef OBJECTALIASED_HPP +#define OBJECTALIASED_HPP + +#include "CustomMacros.hpp" + +// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES) +class Object1Aliased : public QObject +{ + QO1_ALIAS +public: + Object1Aliased(); + +signals: + void aSignal(); + +public slots: + void aSlot(); +}; + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/MocMacroName/Object2Aliased.cpp new file mode 100644 index 0000000..4b09dd1 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object2Aliased.cpp @@ -0,0 +1,9 @@ +#include "Object2Aliased.hpp" + +Object2Aliased::Object2Aliased() +{ +} + +void Object2Aliased::aSlot() +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/MocMacroName/Object2Aliased.hpp new file mode 100644 index 0000000..b9bdc12 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object2Aliased.hpp @@ -0,0 +1,20 @@ +#ifndef OBJECT2ALIASED_HPP +#define OBJECT2ALIASED_HPP + +#include "CustomMacros.hpp" + +// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES) +class Object2Aliased : public QObject +{ + QO2_ALIAS +public: + Object2Aliased(); + +signals: + void aSignal(); + +public slots: + void aSlot(); +}; + +#endif diff --git a/Tests/QtAutogen/MocMacroName/main.cpp b/Tests/QtAutogen/MocMacroName/main.cpp new file mode 100644 index 0000000..3b45d04 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/main.cpp @@ -0,0 +1,13 @@ +#include "Gadget.hpp" +#include "Object.hpp" +#include "Object1Aliased.hpp" +#include "Object2Aliased.hpp" + +int main(int argv, char** args) +{ + Gadget gadget; + Object object; + Object1Aliased object1Aliased; + Object2Aliased object2Aliased; + return 0; +} |