2022-03-10 18:49:42 +00:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2022-04-19 17:45:26 +00:00
|
|
|
project(TestStatusQ LANGUAGES CXX)
|
2022-03-10 18:49:42 +00:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
2022-08-08 09:31:24 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
# 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)
|
2022-04-19 17:45:26 +00:00
|
|
|
|
|
|
|
add_test(NAME ${PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} -input "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
add_custom_target("Run_${PROJECT_NAME}" COMMAND ${CMAKE_CTEST_COMMAND} --test-dir "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
add_dependencies("Run_${PROJECT_NAME}" ${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}
|
|
|
|
)
|
|
|
|
|
2022-04-19 17:45:26 +00:00
|
|
|
add_subdirectory(src)
|
2022-03-21 11:04:11 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
)
|
2023-04-14 08:18:56 +00:00
|
|
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|
|
|
STATUSQ_MODULE_PATH="${STATUSQ_MODULE_PATH}"
|
|
|
|
STATUSQ_MODULE_IMPORT_PATH="${STATUSQ_MODULE_IMPORT_PATH}"
|
|
|
|
)
|