diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-01-24 17:01:59 +0100 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-01-28 21:04:40 +0100 |
commit | f7ae1d8ad6d0db2b6656ed77f7de12189badf05c (patch) | |
tree | c45b1921831766ea0242d769e28e915b4dbf47a7 /Tests/QtAutogen | |
parent | 4b989d5f158e5135bf543438af00b03db0102ade (diff) | |
download | cmake-f7ae1d8ad6d0db2b6656ed77f7de12189badf05c.tar.gz |
QtAutogen: Short-circut some logic when moc is not available.
This is the case when AUTOMOC is false. This prevents creating rules
to moc the files in the absense of moc.
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/QtAutogen/uiconly.cpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/uiconly.h | 20 | ||||
-rw-r--r-- | Tests/QtAutogen/uiconly.ui | 24 |
4 files changed, 71 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 7b99395bdb..515bf5b09f 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -11,6 +11,11 @@ if (QT_TEST_VERSION STREQUAL 4) include(UseQt4) set(QT_QTCORE_TARGET Qt4::QtCore) + + macro(qtx_wrap_cpp) + qt4_wrap_cpp(${ARGN}) + endmacro() + else() if (NOT QT_TEST_VERSION STREQUAL 5) message(SEND_ERROR "Invalid Qt version specified.") @@ -25,6 +30,11 @@ else() if(Qt5_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() + + macro(qtx_wrap_cpp) + qt5_wrap_cpp(${ARGN}) + endmacro() + endif() @@ -77,3 +87,7 @@ set_target_properties(empty PROPERTIES AUTOMOC TRUE) target_link_libraries(empty no_link_language) add_library(no_link_language STATIC empty.h) set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) + +qtx_wrap_cpp(uicOnlyMoc uiconly.h) +add_executable(uiconly uiconly.cpp ${uicOnlyMoc}) +target_link_libraries(uiconly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/uiconly.cpp b/Tests/QtAutogen/uiconly.cpp new file mode 100644 index 0000000000..cdb33184d9 --- /dev/null +++ b/Tests/QtAutogen/uiconly.cpp @@ -0,0 +1,13 @@ + +#include "uiconly.h" + +UicOnly::UicOnly(QWidget *parent) + : QWidget(parent), ui(new Ui::UicOnly) +{ + +} + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/uiconly.h b/Tests/QtAutogen/uiconly.h new file mode 100644 index 0000000000..9e21f82e48 --- /dev/null +++ b/Tests/QtAutogen/uiconly.h @@ -0,0 +1,20 @@ + +#ifndef UIC_ONLY_H +#define UIC_ONLY_H + +#include <QWidget> +#include <memory> + +#include "ui_uiconly.h" + +class UicOnly : public QWidget +{ + Q_OBJECT +public: + explicit UicOnly(QWidget *parent = 0); + +private: + const std::auto_ptr<Ui::UicOnly> ui; +}; + +#endif diff --git a/Tests/QtAutogen/uiconly.ui b/Tests/QtAutogen/uiconly.ui new file mode 100644 index 0000000000..13fb832eb7 --- /dev/null +++ b/Tests/QtAutogen/uiconly.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UicOnly</class> + <widget class="QWidget" name="UicOnly"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |