diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-05 12:43:50 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-10 12:01:29 (GMT) |
commit | 112cba927abfd54e72d12831dc668148c1465446 (patch) | |
tree | 89417c300dfbd26331acea28fbc00dfd21b66ffd /Tests/QtAutogen | |
parent | 948d5d18fd6deed24ede54cb0e3b017511f99559 (diff) | |
download | CMake-112cba927abfd54e72d12831dc668148c1465446.zip CMake-112cba927abfd54e72d12831dc668148c1465446.tar.gz CMake-112cba927abfd54e72d12831dc668148c1465446.tar.bz2 |
QtAutogen: Fix AUTOGEN depends on custom command output with VS.
Visual Studio is handled as a special case for autogen depends. However,
the special handling works only for target dependencies, not file
dependencies output by a custom command.
Use a PRE_BUILD step only if all depends are targets.
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/QtAutogen/generated.h | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/myotherinterface.h.in | 14 |
3 files changed, 24 insertions, 3 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 4da125f..0821b45 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -58,11 +58,17 @@ add_custom_target(generate_moc_input COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" ) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" +) + 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 generated.cpp ) -set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input) +set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") set_target_properties(QtAutogen codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutogen/generated.h b/Tests/QtAutogen/generated.h index dd22489..b6c2711 100644 --- a/Tests/QtAutogen/generated.h +++ b/Tests/QtAutogen/generated.h @@ -5,11 +5,12 @@ #include <QObject> #include "myinterface.h" +#include "myotherinterface.h" -class Generated : public QObject, MyInterface +class Generated : public QObject, MyInterface, MyOtherInterface { Q_OBJECT - Q_INTERFACES(MyInterface) + Q_INTERFACES(MyInterface MyOtherInterface) public: explicit Generated(QObject *parent = 0); }; diff --git a/Tests/QtAutogen/myotherinterface.h.in b/Tests/QtAutogen/myotherinterface.h.in new file mode 100644 index 0000000..d21e7af --- /dev/null +++ b/Tests/QtAutogen/myotherinterface.h.in @@ -0,0 +1,14 @@ + +#ifndef MYOTHERINTERFACE_H +#define MYOTHERINTERFACE_H + +#include <QObject> + +class MyOtherInterface +{ + +}; + +Q_DECLARE_INTERFACE(MyOtherInterface, "org.cmake.example.MyOtherInterface") + +#endif |