diff options
author | Brad King <brad.king@kitware.com> | 2013-05-21 19:12:35 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-05-21 19:12:35 (GMT) |
commit | 80f30aa6bf76c795631f576a25295f59b077afef (patch) | |
tree | 5dccd5029da4cea9a5a0e941187fd6cdbcbba976 /Tests/QtAutomoc | |
parent | f206cce2cac8b018d94b2c4f39b35c6928d38bd3 (diff) | |
parent | 6489015c75367493c9ea6a7bea69b67a88972651 (diff) | |
download | CMake-80f30aa6bf76c795631f576a25295f59b077afef.zip CMake-80f30aa6bf76c795631f576a25295f59b077afef.tar.gz CMake-80f30aa6bf76c795631f576a25295f59b077afef.tar.bz2 |
Merge topic 'Automoc-Qt4-Qt5'
6489015 Remove an endif() followed by an if() for the same condition.
e7813b1 Add a test for Qt5Automoc
27fb96b Make the QtAutomoc test compile with either Qt 4 or Qt 5
Diffstat (limited to 'Tests/QtAutomoc')
-rw-r--r-- | Tests/QtAutomoc/Adir/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/QtAutomoc/CMakeLists.txt | 23 | ||||
-rw-r--r-- | Tests/QtAutomoc/calwidget.cpp | 17 | ||||
-rw-r--r-- | Tests/QtAutomoc/main.cpp | 2 |
4 files changed, 35 insertions, 9 deletions
diff --git a/Tests/QtAutomoc/Adir/CMakeLists.txt b/Tests/QtAutomoc/Adir/CMakeLists.txt index 1712223..a1c36ff 100644 --- a/Tests/QtAutomoc/Adir/CMakeLists.txt +++ b/Tests/QtAutomoc/Adir/CMakeLists.txt @@ -4,5 +4,5 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library(libA SHARED libA.cpp) -target_link_libraries(libA LINK_PUBLIC Qt4::QtCore) +target_link_libraries(libA LINK_PUBLIC ${QT_QTCORE_TARGET}) generate_export_header(libA) diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index fd624c8..655942f 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -2,9 +2,28 @@ cmake_minimum_required(VERSION 2.8) project(QtAutomoc) -find_package(Qt4 REQUIRED) +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + + include(UseQt4) + + set(QT_QTCORE_TARGET Qt4::QtCore) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + find_package(Qt5Widgets REQUIRED) + + set(QT_QTCORE_TARGET Qt5::Core) + + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + set(QT_LIBRARIES Qt5::Widgets) + + if(Qt5_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + endif() +endif() -include(UseQt4) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Tests/QtAutomoc/calwidget.cpp b/Tests/QtAutomoc/calwidget.cpp index 24f3b4e..cbfa5a8 100644 --- a/Tests/QtAutomoc/calwidget.cpp +++ b/Tests/QtAutomoc/calwidget.cpp @@ -38,7 +38,14 @@ ** ****************************************************************************/ - #include <QtGui> + #include <QComboBox> + #include <QGridLayout> + #include <QLabel> + #include <QGroupBox> + #include <QCheckBox> + #include <QDateEdit> + #include <QCalendarWidget> + #include <QTextCharFormat> #include "calwidget.h" @@ -414,10 +421,10 @@ QComboBox *Window::createColorComboBox() { QComboBox *comboBox = new QComboBox; - comboBox->addItem(tr("Red"), Qt::red); - comboBox->addItem(tr("Blue"), Qt::blue); - comboBox->addItem(tr("Black"), Qt::black); - comboBox->addItem(tr("Magenta"), Qt::magenta); + comboBox->addItem(tr("Red"), QColor(Qt::red)); + comboBox->addItem(tr("Blue"), QColor(Qt::blue)); + comboBox->addItem(tr("Black"), QColor(Qt::black)); + comboBox->addItem(tr("Magenta"), QColor(Qt::magenta)); return comboBox; } diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutomoc/main.cpp index d952171..bd80180 100644 --- a/Tests/QtAutomoc/main.cpp +++ b/Tests/QtAutomoc/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtGui> +#include <QApplication> #include "codeeditor.h" #include "calwidget.h" |