Port to Qt6.

This commit is contained in:
Andrius Štikonas 2022-01-16 00:17:46 +00:00
parent 08d2e3dc2c
commit 73de1709e2
5 changed files with 21 additions and 13 deletions

View File

@ -22,7 +22,7 @@ set(CMAKE_USE_RELATIVE_PATHS OFF)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# Dependencies
set(QT_MIN_VERSION "5.14.0")
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.88")
set(BLKID_MIN_VERSION "2.33.2")
# PolkitQt5-1
@ -49,7 +49,11 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX KPMCORE
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfigVersion.cmake"
SOVERSION ${SOVERSION})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
if (NOT QT_MAJOR_VERSION)
set(QT_MAJOR_VERSION "5")
endif()
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} COMPONENTS REQUIRED
Core
DBus
Gui
@ -63,7 +67,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
WidgetsAddons
)
find_package(PolkitQt5-1 REQUIRED)
find_package(PolkitQt${QT_MAJOR_VERSION}-1 REQUIRED)
# use sane compile flags
add_definitions(

View File

@ -33,11 +33,11 @@ ki18n_wrap_ui(kpmcore_SRCS ${gui_UIFILES})
add_library(kpmcore SHARED ${kpmcore_SRCS})
target_link_libraries( kpmcore PUBLIC
Qt5::Core
Qt${QT_MAJOR_VERSION}::Core
PRIVATE
${BLKID_LIBRARIES}
Qt5::DBus
Qt5::Gui
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Gui
KF5::I18n
KF5::CoreAddons
KF5::WidgetsAddons

View File

@ -11,19 +11,19 @@
set(helper_interface_xml org.kde.kpmcore.helperinterface.xml)
qt5_generate_dbus_interface(
qt_generate_dbus_interface(
util/externalcommand.h
${application_interface_xml}
OPTIONS -a
)
qt5_generate_dbus_interface(
qt_generate_dbus_interface(
util/externalcommandhelper.h
${helper_interface_xml}
OPTIONS -a
)
qt5_add_dbus_interface(HelperInterface_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${helper_interface_xml} externalcommandhelper_interface)
qt_add_dbus_interface(HelperInterface_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${helper_interface_xml} externalcommandhelper_interface)
set(UTIL_SRC
${HelperInterface_SRCS}
@ -49,10 +49,10 @@ add_executable(kpmcore_externalcommand
)
target_link_libraries(kpmcore_externalcommand
Qt5::Core
Qt5::DBus
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
KF5::I18n
PolkitQt5-1::Core
PolkitQt${QT_MAJOR_VERSION}-1::Core
)
install(TARGETS kpmcore_externalcommand DESTINATION ${KDE_INSTALL_LIBEXECDIR})

View File

@ -309,7 +309,11 @@ QVariantMap ExternalCommandHelper::RunCommand(const QString& command, const QStr
if (!isCallerAuthorized()) {
return {};
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#endif
QVariantMap reply;
reply[QStringLiteral("success")] = true;

View File

@ -26,7 +26,7 @@ target_link_libraries(testhelpers PRIVATE kpmcore)
macro (kpm_test name)
add_executable(${name} ${ARGN})
target_link_libraries(${name} testhelpers kpmcore Qt5::Core)
target_link_libraries(${name} testhelpers kpmcore Qt${QT_MAJOR_VERSION}::Core)
endmacro()
###