diff options
Diffstat (limited to 'Tests/QtAutomoc/CMakeLists.txt')
-rw-r--r-- | Tests/QtAutomoc/CMakeLists.txt | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index fd624c8..69e52ac 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -2,9 +2,31 @@ cmake_minimum_required(VERSION 2.8) project(QtAutomoc) -find_package(Qt4 REQUIRED) +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) +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}) |