diff --git a/CMakeLists.txt b/CMakeLists.txt index 9023b53..1167c7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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( diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb343f2..22e4405 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index f22f48f..afc4824 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -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}) diff --git a/src/util/externalcommandhelper.cpp b/src/util/externalcommandhelper.cpp index 0fa400d..62290b0 100644 --- a/src/util/externalcommandhelper.cpp +++ b/src/util/externalcommandhelper.cpp @@ -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; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9ae6473..262c38f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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() ###