diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-03-16 14:52:18 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-03-16 17:57:01 (GMT) |
commit | e7813b15a63a4ff5150d22b01ef47b51b22045e5 (patch) | |
tree | 4fcfa972f2295cc680430cd2093864eac5dc1303 /Tests/QtAutomoc | |
parent | 27fb96b9783ba13ce4c8bd681b73c6f3a892d90c (diff) | |
download | CMake-e7813b15a63a4ff5150d22b01ef47b51b22045e5.zip CMake-e7813b15a63a4ff5150d22b01ef47b51b22045e5.tar.gz CMake-e7813b15a63a4ff5150d22b01ef47b51b22045e5.tar.bz2 |
Add a test for Qt5Automoc
The same source is used as for the Qt4Automoc test.
Diffstat (limited to 'Tests/QtAutomoc')
-rw-r--r-- | Tests/QtAutomoc/Adir/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/QtAutomoc/CMakeLists.txt | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/Tests/QtAutomoc/Adir/CMakeLists.txt b/Tests/QtAutomoc/Adir/CMakeLists.txt index abd328e..ebfdb5d 100644 --- a/Tests/QtAutomoc/Adir/CMakeLists.txt +++ b/Tests/QtAutomoc/Adir/CMakeLists.txt @@ -4,5 +4,5 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_BUILD_INTERFACE_INCLUDES 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 ebfbb03..49d433f 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}) |