diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Qt4Targets/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/Qt4Targets/interface/myinterface.h | 12 | ||||
-rw-r--r-- | Tests/Qt4Targets/main_gen_test.cpp | 21 | ||||
-rw-r--r-- | Tests/Qt4Targets/main_wrap_test.cpp | 11 | ||||
-rw-r--r-- | Tests/Qt4Targets/mywrapobject.h | 17 |
5 files changed, 78 insertions, 0 deletions
diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt index d0c9c66..af9fc3f 100644 --- a/Tests/Qt4Targets/CMakeLists.txt +++ b/Tests/Qt4Targets/CMakeLists.txt @@ -19,3 +19,20 @@ if (WIN32) target_link_libraries(activeqtexe Qt4::QAxServer Qt4::QtGui) endif() endif() + +qt4_generate_moc(main_gen_test.cpp + "${CMAKE_CURRENT_BINARY_DIR}/main_gen_test.moc" + TARGET Qt4GenerateMacroTest +) +add_executable(Qt4GenerateMacroTest WIN32 main_gen_test.cpp "${CMAKE_CURRENT_BINARY_DIR}/main_gen_test.moc") +set_property(TARGET Qt4GenerateMacroTest PROPERTY AUTOMOC OFF) +target_include_directories(Qt4GenerateMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface") +target_link_libraries(Qt4GenerateMacroTest Qt4::QtGui) + +qt4_wrap_cpp(moc_file mywrapobject.h + TARGET Qt4WrapMacroTest +) +add_executable(Qt4WrapMacroTest WIN32 main_wrap_test.cpp ${moc_file}) +set_property(TARGET Qt4WrapMacroTest PROPERTY AUTOMOC OFF) +target_include_directories(Qt4WrapMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface") +target_link_libraries(Qt4WrapMacroTest Qt4::QtGui) diff --git a/Tests/Qt4Targets/interface/myinterface.h b/Tests/Qt4Targets/interface/myinterface.h new file mode 100644 index 0000000..59b43ad --- /dev/null +++ b/Tests/Qt4Targets/interface/myinterface.h @@ -0,0 +1,12 @@ + +#ifndef MYINTERFACE_H +#define MYINTERFACE_H + +class MyInterface +{ + +}; + +Q_DECLARE_INTERFACE(MyInterface, "org.cmake.example.MyInterface") + +#endif diff --git a/Tests/Qt4Targets/main_gen_test.cpp b/Tests/Qt4Targets/main_gen_test.cpp new file mode 100644 index 0000000..984424b --- /dev/null +++ b/Tests/Qt4Targets/main_gen_test.cpp @@ -0,0 +1,21 @@ + +#include <QObject> + +#include "myinterface.h" + +class MyObject : public QObject, MyInterface +{ + Q_OBJECT + Q_INTERFACES(MyInterface) +public: + explicit MyObject(QObject *parent = 0) : QObject(parent) { } +}; + +int main(int argc, char **argv) +{ + MyObject mo; + mo.objectName(); + return 0; +} + +#include "main_gen_test.moc" diff --git a/Tests/Qt4Targets/main_wrap_test.cpp b/Tests/Qt4Targets/main_wrap_test.cpp new file mode 100644 index 0000000..21edc7b --- /dev/null +++ b/Tests/Qt4Targets/main_wrap_test.cpp @@ -0,0 +1,11 @@ + +#include <QObject> + +#include "mywrapobject.h" + +int main(int argc, char **argv) +{ + MyWrapObject mwo; + mwo.objectName(); + return 0; +} diff --git a/Tests/Qt4Targets/mywrapobject.h b/Tests/Qt4Targets/mywrapobject.h new file mode 100644 index 0000000..de23540 --- /dev/null +++ b/Tests/Qt4Targets/mywrapobject.h @@ -0,0 +1,17 @@ + +#ifndef MYWRAPOBJECT_H +#define MYWRAPOBJECT_H + +#include <QObject> + +#include "myinterface.h" + +class MyWrapObject : public QObject, MyInterface +{ + Q_OBJECT + Q_INTERFACES(MyInterface) +public: + explicit MyWrapObject(QObject *parent = 0) : QObject(parent) { } +}; + +#endif |