diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-11-20 15:28:51 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-11-22 06:34:29 +0200 |
commit | 9cf47946fc872ed95f1b3a766658dd5076a5d473 (patch) | |
tree | 24ce0695b81eac0e3b94f59079e3e05dab5cc8d8 /tests/auto/gui/kernel/qguitimer | |
parent | 2dc0c01449c0c55468957f7553813ca7f97989d4 (diff) |
tst_QTimer: refactor CMake code
It's used to build different variations of the unittest,
linking against QtCore-only/QtGui, with/without GLib, that's four
individual tests.
Change-Id: Iaf0f37041dbb148134631f86be99feaa881a8ce8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qguitimer')
-rw-r--r-- | tests/auto/gui/kernel/qguitimer/CMakeLists.txt | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tests/auto/gui/kernel/qguitimer/CMakeLists.txt b/tests/auto/gui/kernel/qguitimer/CMakeLists.txt index 1f27b5b919..bc292e133b 100644 --- a/tests/auto/gui/kernel/qguitimer/CMakeLists.txt +++ b/tests/auto/gui/kernel/qguitimer/CMakeLists.txt @@ -11,25 +11,28 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) endif() -qt_internal_add_test(tst_qguitimer - SOURCES - ../../../corelib/kernel/qtimer/tst_qtimer.cpp - LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::TestPrivate -) - -if(QT_FEATURE_glib AND UNIX) - # only exists as a different dispatcher for XCB - qt_internal_add_test(tst_qguitimer_no_glib +function(addGuiTimerTest test) + qt_internal_add_test(${test} SOURCES ../../../corelib/kernel/qtimer/tst_qtimer.cpp - DEFINES - DISABLE_GLIB LIBRARIES Qt::CorePrivate Qt::Gui Qt::TestPrivate ) +endfunction() + +addGuiTimerTest(tst_qguitimer) +qt_internal_extend_target(tst_qguitimer + DEFINES + tst_Qtimer=tst_QGuiTimer +) + +if(QT_FEATURE_glib AND UNIX) + addGuiTimerTest(tst_qguitimer_no_glib) + qt_internal_extend_target(tst_qguitimer_no_glib + DEFINES + DISABLE_GLIB + tst_QTimer=tst_QGuiTimer_no_glib # Class name in the unittest + ) endif() |