aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-09-14 13:55:25 +0200
committerKai Koehne <kai.koehne@qt.io>2020-09-18 15:06:24 +0000
commit1b09888ba997e524efcd9cb01885d73ce563c2b6 (patch)
treef14e0ee2d12d9d9fdc884727cad247fc3c9a6291 /share/qtcreator
parent6225d33c282fc56d1c7b634bdeef04bccf6a914a (diff)
Auto Test Project: Make CMakeLists.txt file Qt 6 compatible
Change-Id: I2289c60e44e8e97de7634342de166bf299934e76 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'share/qtcreator')
-rw-r--r--share/qtcreator/templates/wizards/autotest/files/tst.txt22
1 files changed, 13 insertions, 9 deletions
diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.txt b/share/qtcreator/templates/wizards/autotest/files/tst.txt
index 569bf4d01d..161fd0ff26 100644
--- a/share/qtcreator/templates/wizards/autotest/files/tst.txt
+++ b/share/qtcreator/templates/wizards/autotest/files/tst.txt
@@ -3,10 +3,12 @@ cmake_minimum_required(VERSION 3.5)
project(%{TestCaseName} LANGUAGES CXX)
@if "%{TestFrameWork}" == "QtTest"
-
-find_package(Qt5Test REQUIRED)
@if "%{RequireGUI}" == "true"
-find_package(Qt5Gui REQUIRED)
+find_package(QT NAMES Qt5 Qt6 COMPONENTS Gui Test REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Test REQUIRED)
+@else
+find_package(QT NAMES Qt5 Qt6 COMPONENTS Test REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED)
@endif
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -23,14 +25,15 @@ add_executable(%{TestCaseName} %{TestCaseFileWithCppSuffix})
add_test(NAME %{TestCaseName} COMMAND %{TestCaseName})
@if "%{RequireGUI}" == "true"
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::Gui Qt5::Test)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Test)
@else
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::Test)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Test)
@endif
@endif
@if "%{TestFrameWork}" == "QtQuickTest"
-find_package(Qt5QuickTest REQUIRED)
+find_package(QT NAMES Qt5 Qt6 COMPONENTS QuickTest REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS QuickTest REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -48,7 +51,7 @@ add_definitions(-DQUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(%{TestCaseName} %{MainCppName})
add_test(NAME %{TestCaseName} COMMAND %{TestCaseName})
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::QuickTest)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::QuickTest)
@endif
@if "%{TestFrameWork}" == "GTest"
@@ -120,13 +123,14 @@ endif ()
SET(CMAKE_CXX_STANDARD 11)
@if "%{Catch2NeedsQt}" == "true"
-find_package(Qt5Gui REQUIRED)
+find_package(QT NAMES Qt5 Qt6 COMPONENTS Gui REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
@endif
add_executable(${PROJECT_NAME} %{TestCaseFileWithCppSuffix} main.cpp)
@if "%{Catch2NeedsQt}" == "true"
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::Gui)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Gui)
@endif
if (DEFINED ENV{CATCH_INCLUDE_DIR})