Port to Qt6.
This commit is contained in:
parent
08d2e3dc2c
commit
73de1709e2
|
@ -22,7 +22,7 @@ set(CMAKE_USE_RELATIVE_PATHS OFF)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
set(QT_MIN_VERSION "5.14.0")
|
set(QT_MIN_VERSION "5.15.0")
|
||||||
set(KF5_MIN_VERSION "5.88")
|
set(KF5_MIN_VERSION "5.88")
|
||||||
set(BLKID_MIN_VERSION "2.33.2")
|
set(BLKID_MIN_VERSION "2.33.2")
|
||||||
# PolkitQt5-1
|
# PolkitQt5-1
|
||||||
|
@ -49,7 +49,11 @@ ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX KPMCORE
|
||||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfigVersion.cmake"
|
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfigVersion.cmake"
|
||||||
SOVERSION ${SOVERSION})
|
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
|
Core
|
||||||
DBus
|
DBus
|
||||||
Gui
|
Gui
|
||||||
|
@ -63,7 +67,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
|
||||||
WidgetsAddons
|
WidgetsAddons
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(PolkitQt5-1 REQUIRED)
|
find_package(PolkitQt${QT_MAJOR_VERSION}-1 REQUIRED)
|
||||||
|
|
||||||
# use sane compile flags
|
# use sane compile flags
|
||||||
add_definitions(
|
add_definitions(
|
||||||
|
|
|
@ -33,11 +33,11 @@ ki18n_wrap_ui(kpmcore_SRCS ${gui_UIFILES})
|
||||||
|
|
||||||
add_library(kpmcore SHARED ${kpmcore_SRCS})
|
add_library(kpmcore SHARED ${kpmcore_SRCS})
|
||||||
target_link_libraries( kpmcore PUBLIC
|
target_link_libraries( kpmcore PUBLIC
|
||||||
Qt5::Core
|
Qt${QT_MAJOR_VERSION}::Core
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${BLKID_LIBRARIES}
|
${BLKID_LIBRARIES}
|
||||||
Qt5::DBus
|
Qt${QT_MAJOR_VERSION}::DBus
|
||||||
Qt5::Gui
|
Qt${QT_MAJOR_VERSION}::Gui
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
KF5::CoreAddons
|
KF5::CoreAddons
|
||||||
KF5::WidgetsAddons
|
KF5::WidgetsAddons
|
||||||
|
|
|
@ -11,19 +11,19 @@
|
||||||
|
|
||||||
set(helper_interface_xml org.kde.kpmcore.helperinterface.xml)
|
set(helper_interface_xml org.kde.kpmcore.helperinterface.xml)
|
||||||
|
|
||||||
qt5_generate_dbus_interface(
|
qt_generate_dbus_interface(
|
||||||
util/externalcommand.h
|
util/externalcommand.h
|
||||||
${application_interface_xml}
|
${application_interface_xml}
|
||||||
OPTIONS -a
|
OPTIONS -a
|
||||||
)
|
)
|
||||||
|
|
||||||
qt5_generate_dbus_interface(
|
qt_generate_dbus_interface(
|
||||||
util/externalcommandhelper.h
|
util/externalcommandhelper.h
|
||||||
${helper_interface_xml}
|
${helper_interface_xml}
|
||||||
OPTIONS -a
|
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
|
set(UTIL_SRC
|
||||||
${HelperInterface_SRCS}
|
${HelperInterface_SRCS}
|
||||||
|
@ -49,10 +49,10 @@ add_executable(kpmcore_externalcommand
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(kpmcore_externalcommand
|
target_link_libraries(kpmcore_externalcommand
|
||||||
Qt5::Core
|
Qt${QT_MAJOR_VERSION}::Core
|
||||||
Qt5::DBus
|
Qt${QT_MAJOR_VERSION}::DBus
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
PolkitQt5-1::Core
|
PolkitQt${QT_MAJOR_VERSION}-1::Core
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS kpmcore_externalcommand DESTINATION ${KDE_INSTALL_LIBEXECDIR})
|
install(TARGETS kpmcore_externalcommand DESTINATION ${KDE_INSTALL_LIBEXECDIR})
|
||||||
|
|
|
@ -309,7 +309,11 @@ QVariantMap ExternalCommandHelper::RunCommand(const QString& command, const QStr
|
||||||
if (!isCallerAuthorized()) {
|
if (!isCallerAuthorized()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||||
|
#endif
|
||||||
|
|
||||||
QVariantMap reply;
|
QVariantMap reply;
|
||||||
reply[QStringLiteral("success")] = true;
|
reply[QStringLiteral("success")] = true;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_link_libraries(testhelpers PRIVATE kpmcore)
|
||||||
|
|
||||||
macro (kpm_test name)
|
macro (kpm_test name)
|
||||||
add_executable(${name} ${ARGN})
|
add_executable(${name} ${ARGN})
|
||||||
target_link_libraries(${name} testhelpers kpmcore Qt5::Core)
|
target_link_libraries(${name} testhelpers kpmcore Qt${QT_MAJOR_VERSION}::Core)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
Loading…
Reference in New Issue