diff options
author | Brad King <brad.king@kitware.com> | 2013-11-26 14:38:40 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-11-26 14:38:40 (GMT) |
commit | 3eca31f81a623e91e1b76fd6012a0645aa8d6432 (patch) | |
tree | fb65bf66d5b70d22f4626742acd140ff8be505d1 /Tests | |
parent | 235c2d26dca77507ab998d6c980827086989e27f (diff) | |
parent | 1320e0768e57754b51294a00480927d50176bf02 (diff) | |
download | CMake-3eca31f81a623e91e1b76fd6012a0645aa8d6432.zip CMake-3eca31f81a623e91e1b76fd6012a0645aa8d6432.tar.gz CMake-3eca31f81a623e91e1b76fd6012a0645aa8d6432.tar.bz2 |
Merge topic 'autogen-depends'
1320e07 cmQtAutogen: Allow specifying depends for autogen targets.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/QtAutogen/generated.cpp | 10 | ||||
-rw-r--r-- | Tests/QtAutogen/generated.h | 17 | ||||
-rw-r--r-- | Tests/QtAutogen/myinterface.h.in | 14 |
4 files changed, 49 insertions, 1 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 7991c4e..9dd5289 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -43,10 +43,17 @@ add_library(codeeditorLib STATIC codeeditor.cpp) add_library(privateSlot OBJECT private_slot.cpp) +add_custom_target(generate_moc_input + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" +) +# set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" PROPERTIES GENERATED TRUE) + add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> - test.qrc resourcetester.cpp + test.qrc resourcetester.cpp generated.cpp ) +set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input) set_target_properties(QtAutogen codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutogen/generated.cpp b/Tests/QtAutogen/generated.cpp new file mode 100644 index 0000000..f53bf53 --- /dev/null +++ b/Tests/QtAutogen/generated.cpp @@ -0,0 +1,10 @@ + +#include "generated.h" + +Generated::Generated(QObject *parent) + : QObject(parent) +{ + +} + +#include "moc_generated.cpp" diff --git a/Tests/QtAutogen/generated.h b/Tests/QtAutogen/generated.h new file mode 100644 index 0000000..dd22489 --- /dev/null +++ b/Tests/QtAutogen/generated.h @@ -0,0 +1,17 @@ + +#ifndef GENERATED_H +#define GENERATED_H + +#include <QObject> + +#include "myinterface.h" + +class Generated : public QObject, MyInterface +{ + Q_OBJECT + Q_INTERFACES(MyInterface) +public: + explicit Generated(QObject *parent = 0); +}; + +#endif diff --git a/Tests/QtAutogen/myinterface.h.in b/Tests/QtAutogen/myinterface.h.in new file mode 100644 index 0000000..c6c0ba1 --- /dev/null +++ b/Tests/QtAutogen/myinterface.h.in @@ -0,0 +1,14 @@ + +#ifndef MYINTERFACE_H +#define MYINTERFACE_H + +#include <QObject> + +class MyInterface +{ + +}; + +Q_DECLARE_INTERFACE(MyInterface, "org.cmake.example.MyInterface") + +#endif |