summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-03 13:57:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-06-03 13:57:01 (GMT)
commit6d4e79e2c361084ae26a8961ac9936052d68fde9 (patch)
tree574a61a9c45764f2e1d267ec09f8d38454c9b6a8 /Tests
parent3caf565d079af73f0ea8aaa7b6f4f212e0fcb15d (diff)
parentfa55751f83dc5d5bd5f80d12c3076ec703262edb (diff)
downloadCMake-6d4e79e2c361084ae26a8961ac9936052d68fde9.zip
CMake-6d4e79e2c361084ae26a8961ac9936052d68fde9.tar.gz
CMake-6d4e79e2c361084ae26a8961ac9936052d68fde9.tar.bz2
Merge topic 'qt4-qt5-CMAKE_AUTOMOC'
fa55751 QtAutomoc: Get the Qt version through the target link interface f776316 Use the qt5::moc imported target instead of a variable.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt14
-rw-r--r--Tests/Qt4And5Automoc/CMakeLists.txt13
-rw-r--r--Tests/Qt4And5Automoc/main.cpp18
-rw-r--r--Tests/Qt4And5Automoc/main_qt4.cpp4
-rw-r--r--Tests/Qt4And5Automoc/main_qt5.cpp4
5 files changed, 53 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index fe9a5f5..cd562c2 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1044,6 +1044,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets")
+
+ if(Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0)
+ add_test(Qt4And5Automoc ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc"
+ "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
+ ${build_generator_args}
+ --build-project Qt4And5Automoc
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
+ --force-new-ctest-process
+ --test-command ${CMAKE_CTEST_COMMAND} -V
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc")
+ endif()
endif()
add_test(ExternalProject ${CMAKE_CTEST_COMMAND}
diff --git a/Tests/Qt4And5Automoc/CMakeLists.txt b/Tests/Qt4And5Automoc/CMakeLists.txt
new file mode 100644
index 0000000..0cc80fe
--- /dev/null
+++ b/Tests/Qt4And5Automoc/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+project(Qt4And5Automoc)
+
+find_package(Qt4 REQUIRED)
+find_package(Qt5Core REQUIRED)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_executable(qt4_exe main_qt4.cpp)
+target_link_libraries(qt4_exe Qt4::QtCore)
+add_executable(qt5_exe main_qt5.cpp)
+target_link_libraries(qt5_exe Qt5::Core)
diff --git a/Tests/Qt4And5Automoc/main.cpp b/Tests/Qt4And5Automoc/main.cpp
new file mode 100644
index 0000000..00fd641
--- /dev/null
+++ b/Tests/Qt4And5Automoc/main.cpp
@@ -0,0 +1,18 @@
+
+#include <QObject>
+
+class SomeObject : public QObject
+{
+ Q_OBJECT
+public:
+ explicit SomeObject(QObject *parent = 0)
+ : QObject(parent)
+ {
+
+ }
+};
+
+int main(int argc, char **argv)
+{
+ return 0;
+}
diff --git a/Tests/Qt4And5Automoc/main_qt4.cpp b/Tests/Qt4And5Automoc/main_qt4.cpp
new file mode 100644
index 0000000..a84ce89
--- /dev/null
+++ b/Tests/Qt4And5Automoc/main_qt4.cpp
@@ -0,0 +1,4 @@
+
+#include "main.cpp"
+
+#include "main_qt4.moc"
diff --git a/Tests/Qt4And5Automoc/main_qt5.cpp b/Tests/Qt4And5Automoc/main_qt5.cpp
new file mode 100644
index 0000000..287b261
--- /dev/null
+++ b/Tests/Qt4And5Automoc/main_qt5.cpp
@@ -0,0 +1,4 @@
+
+#include "main.cpp"
+
+#include "main_qt5.moc"