AutoTest: Fix cmake wizard

If ctest is going to be used we need to enable testing. Do it globally
instead of per framework which already led to forgot it.

Change-Id: Ifdb0e94708a26e2496d708361d5b8163aa2912ad
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-09-13 11:05:40 +02:00
parent f6f2ffde4e
commit 7e965629b0

View File

@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.5)
project(%{TestCaseName} LANGUAGES CXX)
enable_testing()
@if "%{TestFrameWork}" == "QtTest"
@if "%{RequireGUI}" == "true"
find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui Test REQUIRED)
@@ -19,7 +21,6 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing()
add_executable(%{TestCaseName} %{TestCaseFileWithCppSuffix})
add_test(NAME %{TestCaseName} COMMAND %{TestCaseName})
@@ -43,7 +44,6 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing()
# no need to copy around qml test files for shadow builds - just set the respective define
add_definitions(-DQUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
@@ -105,7 +105,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing()
add_executable(%{TestCaseName} %{MainCppName})
add_test(NAME %{TestCaseName} COMMAND %{TestCaseName})