From 729addd82ecb30825097961022d189e956a2e2cf Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 30 Aug 2019 13:13:37 +0200 Subject: Support standalone tests building Also fix some build issues regarding tests. Change-Id: Ie9ba8a0b7932ae2b542614b6c824c4071ad0b548 Reviewed-by: Liang Qi --- CMakeLists.txt | 5 +++-- src/qmldevtools/CMakeLists.txt | 1 + tests/CMakeLists.txt | 19 +++++++++---------- tests/benchmarks/qml/qqmlcomponent/CMakeLists.txt | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07da25c5b2..55b9a1943b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ project(QtDeclarative LANGUAGES CXX C ) -find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Widgets Network) -find_package(Qt6 ${PROJECT_VERSION} CONFIG COMPONENTS Sql) +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Widgets Network + OPTIONAL_COMPONENTS Sql Concurrent) + qt_build_repo() diff --git a/src/qmldevtools/CMakeLists.txt b/src/qmldevtools/CMakeLists.txt index 7d516d8dc2..2a3c07147f 100644 --- a/src/qmldevtools/CMakeLists.txt +++ b/src/qmldevtools/CMakeLists.txt @@ -61,6 +61,7 @@ qt_process_qlalr("${CMAKE_CURRENT_SOURCE_DIR}/../qml/parser/qqmljs.g" QmlDevTool qt_internal_module_info(qml_module "Qml") set(_qml_dev_tools_private_includes $ + $ $ $ ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 33a89765dd..eeddbe0780 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,13 +1,12 @@ -# Generated from tests.pro. - # special case begin -find_package(Qt6 REQUIRED Concurrent) +if(NOT TARGET Qt::Test) + cmake_minimum_required(VERSION 3.15.0) + project(QtDeclarativeTests VERSION 6.0.0 LANGUAGES C CXX ASM) + find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core Test Qml Quick QuickParticles + QmlDevTools QuickWidgets QmlDebug QuickTest QuickShapes + QmlWorkerScript Concurrent) + qt_set_up_standalone_tests_build() +endif() # special case end -add_subdirectory(auto) -# special case begin -# benchmarks not yet ported -# if(QT_CONFIG___contains___release) -# add_subdirectory(benchmarks) -# endif() -# special case end +qt_build_tests() diff --git a/tests/benchmarks/qml/qqmlcomponent/CMakeLists.txt b/tests/benchmarks/qml/qqmlcomponent/CMakeLists.txt index d54f1d09a5..442d405832 100644 --- a/tests/benchmarks/qml/qqmlcomponent/CMakeLists.txt +++ b/tests/benchmarks/qml/qqmlcomponent/CMakeLists.txt @@ -4,7 +4,7 @@ ## tst_qqmlcomponent Binary: ##################################################################### -add_qt_executable(tst_qqmlcomponent +add_qt_executable(tst_qqmlcomponent_benchmark # special case avoid collision with auto test GUI SOURCES testtypes.cpp testtypes.h -- cgit v1.2.3