diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-10-04 11:10:56 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-10-04 11:10:57 (GMT) |
commit | a7420884723c4fb09e6370fb25710a2172c10a0c (patch) | |
tree | 7d1d5cd434ca27e8b038457c784bf08af7f36c2f /Tests/QtAutogen/Complex | |
parent | b3a0bddc4e1c8f1f86078cdffaebbc4c493e4409 (diff) | |
download | CMake-a7420884723c4fb09e6370fb25710a2172c10a0c.zip CMake-a7420884723c4fb09e6370fb25710a2172c10a0c.tar.gz CMake-a7420884723c4fb09e6370fb25710a2172c10a0c.tar.bz2 |
Tests: Add support for testing Qt6
The minimum CMake version for Qt6 is 3.16, so all the calls to
cmake_minimum_required() are updated here to enforce that
minimum. This will avoid any CMake version-related warnings
from Qt.
Avoid hard-coding Qt5 where the tests could now be using
Qt5 or Qt6.
Fixes: #22188
Diffstat (limited to 'Tests/QtAutogen/Complex')
-rw-r--r-- | Tests/QtAutogen/Complex/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/QtAutogen/Complex/codeeditor.cpp | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Tests/QtAutogen/Complex/CMakeLists.txt b/Tests/QtAutogen/Complex/CMakeLists.txt index d9fdf5c..8a9a5d2 100644 --- a/Tests/QtAutogen/Complex/CMakeLists.txt +++ b/Tests/QtAutogen/Complex/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.16) project(Complex) include("../AutogenGuiTest.cmake") @@ -16,6 +16,8 @@ add_library(privateSlot OBJECT private_slot.cpp) # Pass Qt compiler features to targets that don't link against Qt target_compile_features(codeeditorLib PRIVATE ${QT_COMPILE_FEATURES}) target_compile_features(privateSlot PRIVATE ${QT_COMPILE_FEATURES}) +target_link_libraries(codeeditorLib PRIVATE ${QT_LIBRARIES}) +target_link_libraries(privateSlot PRIVATE ${QT_LIBRARIES}) configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY) add_custom_command( diff --git a/Tests/QtAutogen/Complex/codeeditor.cpp b/Tests/QtAutogen/Complex/codeeditor.cpp index 80d6a55..9c9dbc3 100644 --- a/Tests/QtAutogen/Complex/codeeditor.cpp +++ b/Tests/QtAutogen/Complex/codeeditor.cpp @@ -70,7 +70,11 @@ int CodeEditor::lineNumberAreaWidth() ++digits; } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) + int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits; +#else int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; +#endif return space; } |