summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutomoc
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-21 19:12:42 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-21 19:12:42 (GMT)
commit1a2a0daddad3b1e460e5bc9e6f6795524f7c573b (patch)
tree7bde747031d178e325b856b104b6f784d4afe11d /Tests/QtAutomoc
parent80f30aa6bf76c795631f576a25295f59b077afef (diff)
parent5c0f2a131f358ac11da52a919f637b57d34cc544 (diff)
downloadCMake-1a2a0daddad3b1e460e5bc9e6f6795524f7c573b.zip
CMake-1a2a0daddad3b1e460e5bc9e6f6795524f7c573b.tar.gz
CMake-1a2a0daddad3b1e460e5bc9e6f6795524f7c573b.tar.bz2
Merge topic 'test-moc-with-empty-COMPILE_DEFINITIONS'
5c0f2a1 Test the use of target transitive compile definitions with moc.
Diffstat (limited to 'Tests/QtAutomoc')
-rw-r--r--Tests/QtAutomoc/CMakeLists.txt3
-rw-r--r--Tests/QtAutomoc/defines_test/CMakeLists.txt6
-rw-r--r--Tests/QtAutomoc/defines_test/defines_test.cpp38
3 files changed, 47 insertions, 0 deletions
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 655942f..69e52ac 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -5,6 +5,9 @@ project(QtAutomoc)
if (QT_TEST_VERSION STREQUAL 4)
find_package(Qt4 REQUIRED)
+ # Include this directory before using the UseQt4 file.
+ add_subdirectory(defines_test)
+
include(UseQt4)
set(QT_QTCORE_TARGET Qt4::QtCore)
diff --git a/Tests/QtAutomoc/defines_test/CMakeLists.txt b/Tests/QtAutomoc/defines_test/CMakeLists.txt
new file mode 100644
index 0000000..ad4e684
--- /dev/null
+++ b/Tests/QtAutomoc/defines_test/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_executable(defines_test defines_test.cpp)
+set_target_properties(defines_test PROPERTIES AUTOMOC TRUE)
+target_link_libraries(defines_test Qt4::QtGui)
diff --git a/Tests/QtAutomoc/defines_test/defines_test.cpp b/Tests/QtAutomoc/defines_test/defines_test.cpp
new file mode 100644
index 0000000..2836d35
--- /dev/null
+++ b/Tests/QtAutomoc/defines_test/defines_test.cpp
@@ -0,0 +1,38 @@
+
+#include <QObject>
+
+#ifdef QT_GUI_LIB
+#include <QTextDocument>
+
+class SomeDocument : public QTextDocument
+{
+ Q_OBJECT
+
+Q_SIGNALS:
+ void someSig();
+};
+#endif
+
+#ifdef QT_CORE_LIB
+class SomeObject : public QObject
+{
+ Q_OBJECT
+
+Q_SIGNALS:
+ void someSig();
+};
+#endif
+
+int main(int argc, char **argv)
+{
+#ifdef QT_CORE_LIB
+ QMetaObject sosmo = SomeObject::staticMetaObject;
+#endif
+#ifdef QT_GUI_LIB
+ QMetaObject sdsmo = SomeDocument::staticMetaObject;
+#endif
+
+ return 0;
+}
+
+#include "defines_test.moc"