CMake build: Remove usages of Qt5_VERSION

and remove checks for Qt < 6.2, since that is our minimum version.
Except for sdktool and qml2puppet.

Change-Id: Id36cd1a15a5a6e5480e4ae5d0a8ffaea4b2a1864
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Eike Ziller
2023-01-23 11:44:31 +01:00
parent f37aa909ac
commit 06c4df37b9
12 changed files with 19 additions and 48 deletions

View File

@@ -70,37 +70,23 @@ find_package(Qt5
COMPONENTS Concurrent Core Gui Network PrintSupport Qml Sql Widgets Xml Core5Compat ${QT_TEST_COMPONENT} COMPONENTS Concurrent Core Gui Network PrintSupport Qml Sql Widgets Xml Core5Compat ${QT_TEST_COMPONENT}
REQUIRED REQUIRED
) )
if (Qt5_VERSION VERSION_LESS 6.0.0)
install(TARGETS Qt6Core5Compat EXPORT QtCreator)
# Specify standards conformance mode to MSVC 2017 and later # Common intermediate directory for QML modules which are defined via qt_add_qml_module()
# Qt6 has the values as part of the Qt6::Platform target interface set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml_modules")
if (MSVC AND MSVC_VERSION GREATER_EQUAL 1910)
add_compile_options(/permissive- /Zc:__cplusplus)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
add_compile_options(-Wno-missing-field-initializers)
endif()
else()
# Common intermediate directory for QML modules which are defined via qt_add_qml_module()
set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml_modules")
# This includes the code that will enable higher compiler warnings level (/W3 for MSVC, -Wall -Wextra for GCC) # This includes the code that will enable higher compiler warnings level (/W3 for MSVC, -Wall -Wextra for GCC)
# This is controlled by QT_COMPILE_OPTIONS_DISABLE_WARNINGS target property. # This is controlled by QT_COMPILE_OPTIONS_DISABLE_WARNINGS target property.
include(QtCompilerFlags) include(QtCompilerFlags)
if (MSVC AND QT_FEATURE_static_runtime) if (MSVC AND QT_FEATURE_static_runtime)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif() endif()
find_package(Qt5 COMPONENTS LinguistTools QUIET) find_package(Qt5 COMPONENTS LinguistTools QUIET)
find_package(Qt5 COMPONENTS Quick QuickWidgets Designer DesignerComponents Help SerialPort Svg Tools QUIET) find_package(Qt5 COMPONENTS Quick QuickWidgets Designer DesignerComponents Help SerialPort Svg Tools QUIET)
find_package(Threads) find_package(Threads)
find_package(Clang QUIET) find_package(Clang QUIET)
if (Qt5_VERSION VERSION_LESS 6.0.0)
find_package(KF5SyntaxHighlighting QUIET)
endif()
# Crashpad # Crashpad
set(CRASHPAD_BACKEND_URL "" CACHE STRING "Crashpad backend URL") set(CRASHPAD_BACKEND_URL "" CACHE STRING "Crashpad backend URL")

View File

@@ -304,7 +304,8 @@ function(add_qtc_library name)
endif() endif()
get_target_property(have_automoc_prop ${name} AUTOMOC) get_target_property(have_automoc_prop ${name} AUTOMOC)
if("${Qt5_VERSION}" VERSION_GREATER_EQUAL "6.2.0" AND "${have_automoc_prop}") # check for Qt 6 is needed because sdktool & qml2puppet still build with Qt 5
if(Qt6_VERSION AND "${have_automoc_prop}")
qt_extract_metatypes(${name}) qt_extract_metatypes(${name})
endif() endif()
endfunction(add_qtc_library) endfunction(add_qtc_library)

View File

@@ -66,7 +66,7 @@ if (QTC_STATIC_BUILD)
SOURCES "${CMAKE_CURRENT_BINARY_DIR}/plugin_imports.cpp" SOURCES "${CMAKE_CURRENT_BINARY_DIR}/plugin_imports.cpp"
) )
if (Qt5_VERSION VERSION_GREATER_EQUAL 6.0.0 AND TARGET QmlDesigner) if (TARGET QmlDesigner)
qt6_import_qml_plugins(qtcreator qt6_import_qml_plugins(qtcreator
PATH_TO_SCAN "${CMAKE_CURRENT_SOURCE_DIR}/../../share/qtcreator/qmldesigner") PATH_TO_SCAN "${CMAKE_CURRENT_SOURCE_DIR}/../../share/qtcreator/qmldesigner")
endif() endif()

View File

@@ -34,7 +34,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qlitehtml/src/CMakeLists.txt)
set(QLITEHTML_BIN_PATH ${IDE_BIN_PATH}) set(QLITEHTML_BIN_PATH ${IDE_BIN_PATH})
set(QLITEHTML_LIBRARY_PATH ${IDE_LIBRARY_PATH}) set(QLITEHTML_LIBRARY_PATH ${IDE_LIBRARY_PATH})
endif() endif()
set(QT_VERSION_MAJOR ${Qt5_VERSION_MAJOR}) set(QT_VERSION_MAJOR ${Qt6_VERSION_MAJOR})
option(BUILD_TESTING "Build litehtml tests" OFF) # otherwise litehtml downloads googletest option(BUILD_TESTING "Build litehtml tests" OFF) # otherwise litehtml downloads googletest
add_subdirectory(qlitehtml/src) add_subdirectory(qlitehtml/src)
endif() endif()

View File

@@ -1,6 +1,5 @@
add_qtc_library(SqliteC OBJECT add_qtc_library(SqliteC OBJECT
PROPERTIES AUTOMOC OFF AUTOUIC OFF QT_COMPILE_OPTIONS_DISABLE_WARNINGS ON POSITION_INDEPENDENT_CODE ON PROPERTIES AUTOMOC OFF AUTOUIC OFF QT_COMPILE_OPTIONS_DISABLE_WARNINGS ON POSITION_INDEPENDENT_CODE ON
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0
DEFINES SQLITE_CORE SQLITE_CUSTOM_INCLUDE=config.h $<$<CONFIG:Debug>:SQLITE_DEBUG> DEFINES SQLITE_CORE SQLITE_CUSTOM_INCLUDE=config.h $<$<CONFIG:Debug>:SQLITE_DEBUG>
PROPERTIES COMPILE_OPTIONS $<IF:$<CXX_COMPILER_ID:MSVC>,/FIconfig.h,-includeconfig.h> PROPERTIES COMPILE_OPTIONS $<IF:$<CXX_COMPILER_ID:MSVC>,/FIconfig.h,-includeconfig.h>
PUBLIC_INCLUDES PUBLIC_INCLUDES
@@ -18,7 +17,6 @@ add_qtc_library(SqliteC OBJECT
add_qtc_library(Sqlite add_qtc_library(Sqlite
PROPERTIES AUTOMOC OFF AUTOUIC OFF PROPERTIES AUTOMOC OFF AUTOUIC OFF
DEPENDS Qt::Core Threads::Threads ${CMAKE_DL_LIBS} SqliteC DEPENDS Qt::Core Threads::Threads ${CMAKE_DL_LIBS} SqliteC
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0
PUBLIC_INCLUDES PUBLIC_INCLUDES
"${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}"
DEFINES SQLITE_CUSTOM_INCLUDE=config.h $<$<CONFIG:Debug>:SQLITE_REVERSE> DEFINES SQLITE_CUSTOM_INCLUDE=config.h $<$<CONFIG:Debug>:SQLITE_REVERSE>

View File

@@ -207,15 +207,9 @@ if ((NOT WIN32) AND (NOT APPLE))
endif() endif()
set(FONTS_BASE "${QtCreator_SOURCE_DIR}/src/share/3rdparty/studiofonts/") set(FONTS_BASE "${QtCreator_SOURCE_DIR}/src/share/3rdparty/studiofonts/")
if(${Qt5_VERSION} VERSION_LESS "6")
extend_qtc_plugin(Core
SOURCES "${FONTS_BASE}/studiofonts.qrc"
)
else() # < Qt 6
qt_add_resources(Core qt_add_resources(Core
CoreWelcomeScreenFonts_rcc CoreWelcomeScreenFonts_rcc
BASE ${FONTS_BASE} BASE ${FONTS_BASE}
PREFIX "studiofonts" PREFIX "studiofonts"
FILES "${FONTS_BASE}/TitilliumWeb-Regular.ttf" FILES "${FONTS_BASE}/TitilliumWeb-Regular.ttf"
) )
endif()

View File

@@ -1,5 +1,5 @@
add_qtc_plugin(QmlDesigner add_qtc_plugin(QmlDesigner
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 AND TARGET Qt::QuickWidgets AND TARGET Qt::Svg CONDITION TARGET Qt::QuickWidgets AND TARGET Qt::Svg
DEPENDS DEPENDS
QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem
Qt::QuickWidgets Qt::CorePrivate Sqlite Qt::Xml Qt::Svg Qt::QuickWidgets Qt::CorePrivate Sqlite Qt::Xml Qt::Svg
@@ -498,7 +498,7 @@ function(get_and_add_as_subdirectory name repository git_tag build_dir source_di
endfunction() endfunction()
if (WITH_QMLDOM) if (WITH_QMLDOM)
if (Qt5_VERSION VERSION_LESS 6.3.2) if (Qt6_VERSION VERSION_LESS 6.3.2)
message(FATAL_ERROR "You need Qt 6.3.2 or newer to enable WITH_QMLDOM feature.") message(FATAL_ERROR "You need Qt 6.3.2 or newer to enable WITH_QMLDOM feature.")
endif() endif()

View File

@@ -23,13 +23,9 @@ extend_qtc_plugin(QmlPreview
tests/qmlpreviewplugin_test.cpp tests/qmlpreviewplugin_test.h tests/qmlpreviewplugin_test.cpp tests/qmlpreviewplugin_test.h
) )
if(TARGET Qt${QT_VERSION_MAJOR}::QmlPrivate) if(TARGET Qt6::QmlPrivate)
# check if Qt version have_qml_debug_translation_protocol
# will be introduced in Qt 6.2, but there are users
# who needs it in older but special built Qt versions aswell
string(REGEX MATCH "^[0-9]*" QT_VERSION_MAJOR ${Qt5_VERSION})
get_target_property(qmldebugprivate_include_directories get_target_property(qmldebugprivate_include_directories
Qt${QT_VERSION_MAJOR}::QmlPrivate Qt6::QmlPrivate
INTERFACE_INCLUDE_DIRECTORIES INTERFACE_INCLUDE_DIRECTORIES
) )
find_file(have_qml_debug_translation_protocol find_file(have_qml_debug_translation_protocol

View File

@@ -1,4 +1,2 @@
if (${Qt5_VERSION} VERSION_GREATER_EQUAL "6.2.0") add_subdirectory(coretests)
add_subdirectory(coretests) add_subdirectory(wizard)
add_subdirectory(wizard)
endif()

View File

@@ -1,6 +1,6 @@
add_qtc_test(tst_qml_testcore add_qtc_test(tst_qml_testcore
EXCLUDE_FROM_PRECHECK EXCLUDE_FROM_PRECHECK
CONDITION TARGET QmlProjectManager AND Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 CONDITION TARGET QmlProjectManager
DEPENDS DEPENDS
Sqlite Sqlite
QmlDesignerCore QmlDesignerCore

View File

@@ -4,7 +4,6 @@ file(RELATIVE_PATH RELATIVE_TEST_PATH "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_B
file(RELATIVE_PATH TEST_RELATIVE_LIBEXEC_PATH "/${RELATIVE_TEST_PATH}" "/${IDE_LIBEXEC_PATH}") file(RELATIVE_PATH TEST_RELATIVE_LIBEXEC_PATH "/${RELATIVE_TEST_PATH}" "/${IDE_LIBEXEC_PATH}")
add_qtc_test(tst_qtcprocess add_qtc_test(tst_qtcprocess
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0
DEFINES "TEST_RELATIVE_LIBEXEC_PATH=\"${TEST_RELATIVE_LIBEXEC_PATH}\"" DEFINES "TEST_RELATIVE_LIBEXEC_PATH=\"${TEST_RELATIVE_LIBEXEC_PATH}\""
"PROCESS_TESTAPP=\"${CMAKE_CURRENT_BINARY_DIR}/processtestapp\"" "PROCESS_TESTAPP=\"${CMAKE_CURRENT_BINARY_DIR}/processtestapp\""
DEPENDS Utils app_version DEPENDS Utils app_version

View File

@@ -26,7 +26,6 @@ add_qtc_test(unittest GTEST
Qt::Xml Qt::Concurrent Qt::Qml Qt::Gui Qt::Xml Qt::Concurrent Qt::Qml Qt::Gui
Qt6Core5Compat QmlJS Sqlite SqliteC Qt6Core5Compat QmlJS Sqlite SqliteC
Googletest Googletest
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0
DEFINES DEFINES
QT_NO_CAST_TO_ASCII QT_NO_CAST_TO_ASCII
QT_RESTRICTED_CAST_FROM_ASCII QT_RESTRICTED_CAST_FROM_ASCII