2022-03-10 18:49:42 +00:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2022-03-21 11:04:11 +00:00
|
|
|
project(TestControls LANGUAGES CXX)
|
2022-03-10 18:49:42 +00:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
# TODO: Workaround until we make StatusQ a CMake library
|
|
|
|
list(APPEND QML_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../src/")
|
|
|
|
set(QML_IMPORT_PATH "${QML_DIRS}" CACHE STRING "Qt Creator extra qml import paths")
|
|
|
|
set(QML2_IMPORT_PATH "${QML_DIRS}" CACHE STRING "Qt Creator extra qml import paths")
|
|
|
|
|
2022-03-21 11:04:11 +00:00
|
|
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS QuickTest Qml Quick REQUIRED)
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS QuickTest Qml Quick REQUIRED)
|
2022-03-10 18:49:42 +00:00
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
|
|
# 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}")
|
|
|
|
|
2022-03-21 11:04:11 +00:00
|
|
|
add_executable(${PROJECT_NAME} main.cpp)
|
|
|
|
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
2022-03-10 18:49:42 +00:00
|
|
|
|
2022-03-21 11:04:11 +00:00
|
|
|
# TODO: move this to a test helpers library
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PUBLIC
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_subdirectory(TestHelpers)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
2022-03-10 18:49:42 +00:00
|
|
|
Qt${QT_VERSION_MAJOR}::QuickTest
|
2022-03-21 11:04:11 +00:00
|
|
|
Qt${QT_VERSION_MAJOR}::Qml
|
|
|
|
Qt${QT_VERSION_MAJOR}::Quick
|
|
|
|
)
|
2022-03-10 18:49:42 +00:00
|
|
|
|