Clean up some Qt4/KDE4 warnings.

- Enable the "new" automoc policy for KDE4.
  Otherwise, CMake complains because the old policy doesn't run
  automoc on generated sources, e.g. from uic or rcc.
  NOTE: Only on Qt4; CMake doesn't show this for Qt5/Qt6.

- Unset KDE4 variables that are marked "deprecatd" in KF5/KF6.
  Otherwise, if building for both KDE4 and KF5, a lot of deprecated
  variable warnings appear.

- Copy SERVICES_INSTALL_DIR to KDE4_SERVICES_INSTALL_DIR, since it's
  used by the KDE4 UI frontend.
This commit is contained in:
David Korth 2025-01-18 11:18:39 -05:00
parent 9adda4bf15
commit 22753b9cf5
2 changed files with 64 additions and 5 deletions

View File

@ -24,16 +24,27 @@ MACRO(FIND_QT4_AND_KDE4)
# KDE4 not found.
SET(BUILD_KDE4 OFF CACHE INTERNAL "Build the KDE4 plugin." FORCE)
ENDIF(NOT KDE4_FOUND)
# Save certain KDE4 variables with a KDE4 prefix.
# Others will be removed to prevent deprecation warnings with KF5/KF6.
IF(PLUGIN_INSTALL_DIR)
SET(KDE4_PLUGIN_INSTALL_DIR "${PLUGIN_INSTALL_DIR}")
UNSET(PLUGIN_INSTALL_DIR)
UNSET(PLUGIN_INSTALL_DIR CACHE)
ELSE(PLUGIN_INSTALL_DIR)
ELSEIF(PLUGIN_INSTALL_DIR)
# PLUGIN_INSTALL_DIR might not be set in some cases.
# Use KDE4's documented default value.
SET(KDE4_PLUGIN_INSTALL_DIR "${KDE4_LIB_INSTALL_DIR}/kde4")
ENDIF(PLUGIN_INSTALL_DIR)
IF(NOT KDE4_SERVICES_INSTALL_DIR)
IF(SERVICES_INSTALL_DIR)
SET(KDE4_SERVICES_INSTALL_DIR "${SERVICES_INSTALL_DIR}")
ELSE(SERVICES_INSTALL_DIR)
# SERVICES_INSTALL_DIR might not be set in some cases.
# Use KDE4's documented default value.
SET(KDE4_SERVICES_INSTALL_DIR "${KDE4_INSTALL_DIR}/share/kde4/services")
ENDIF(SERVICES_INSTALL_DIR)
ENDIF(NOT KDE4_SERVICES_INSTALL_DIR)
# Get rid of the explicit C90 setting.
STRING(REPLACE "-std=iso9899:1990" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
@ -62,4 +73,38 @@ MACRO(FIND_QT4_AND_KDE4)
UNSET(OLD_CMAKE_C_FLAGS_${_config})
UNSET(OLD_CMAKE_CXX_FLAGS_${_config})
ENDFOREACH(_config)
# NOTE: Several KDE4 path variables are deprecated as of KF5.
# Unset them to prevent KF5's ECM modules from showing warnings.
# TODO: Are any of these actually useful for us?
UNSET(AUTOSTART_INSTALL_DIR)
UNSET(CONFIG_INSTALL_DIR)
UNSET(DATA_INSTALL_DIR)
UNSET(DBUS_INTERFACES_INSTALL_DIR)
UNSET(DBUS_SERVICES_INSTALL_DIR)
UNSET(DBUS_SYSTEM_SERVICES_INSTALL_DIR)
UNSET(EXEC_INSTALL_PREFIX)
UNSET(HTML_INSTALL_DIR)
UNSET(ICON_INSTALL_DIR)
UNSET(IMPORTS_INSTALL_DIR)
UNSET(KCFG_INSTALL_DIR)
UNSET(KCONF_UPDATE_INSTALL_DIR)
UNSET(LOCALE_INSTALL_DIR)
UNSET(MAN_INSTALL_DIR)
UNSET(PLUGIN_INSTALL_DIR)
UNSET(SERVICES_INSTALL_DIR)
UNSET(SERVICETYPES_INSTALL_DIR)
UNSET(SOUND_INSTALL_DIR)
UNSET(TEMPLATES_INSTALL_DIR)
UNSET(WALLPAPER_INSTALL_DIR)
UNSET(XDG_APPS_INSTALL_DIR)
UNSET(XDG_DIRECTORY_INSTALL_DIR)
UNSET(XDG_MIME_INSTALL_DIR)
UNSET(LIB_INSTALL_DIR)
UNSET(INCLUDE_INSTALL_DIR)
#UNSET(KDE_INSTALL_BINDIR)
#UNSET(KDE_INSTALL_LIBDIR)
#UNSET(KDE_INSTALL_INCLUDEDIR)
ENDMACRO(FIND_QT4_AND_KDE4)

View File

@ -1,6 +1,14 @@
# KDE 4.x UI frontend
PROJECT(rom-properties-kde4 LANGUAGES CXX)
# Enable the "new" automoc policy for KDE4.
# Otherwise, CMake complains because the old policy doesn't run
# automoc on generated sources, e.g. from uic or rcc.
# NOTE: Only on Qt4; CMake doesn't show this for Qt5/Qt6.
IF(POLICY CMP0071)
CMAKE_POLICY(SET CMP0071 NEW)
ENDIF(POLICY CMP0071)
# Find Qt4 and KDE4.
INCLUDE(RP_FindQt4andKDE4)
FIND_QT4_AND_KDE4()
@ -34,6 +42,9 @@ IF(HAVE_QtDBus)
QT4_ADD_DBUS_INTERFACES(${PROJECT_NAME}_DBUS_IFACE_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/../../dbus/org.freedesktop.NetworkManager.xml"
)
# NOTE: Setting CMAKE_POLICY(SET CMP0071 NEW) causes the generated D-Bus .moc
# to be included twice. Work around this by setting SKIP_AUTOMOC.
SET_PROPERTY(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/networkmanagerinterface.h" PROPERTY SKIP_AUTOMOC ON)
ENDIF(0)
IF(HAVE_QtDBus_NOTIFY)
STRING(REGEX REPLACE "([^;]+)" "../\\1" ${PROJECT_NAME}-notify_SRCS "${rom-properties-kde-notify_SRCS}")
@ -41,6 +52,9 @@ IF(HAVE_QtDBus)
QT4_ADD_DBUS_INTERFACES(${PROJECT_NAME}_DBUS_IFACE_SRCS_2
"${CMAKE_CURRENT_SOURCE_DIR}/../../dbus/org.freedesktop.Notifications.xml"
)
# NOTE: Setting CMAKE_POLICY(SET CMP0071 NEW) causes the generated D-Bus .moc
# to be included twice. Work around this by setting SKIP_AUTOMOC.
SET_PROPERTY(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/notificationsinterface.h" PROPERTY SKIP_AUTOMOC ON)
ENDIF(HAVE_QtDBus_NOTIFY)
ENDIF(HAVE_QtDBus)
@ -163,14 +177,14 @@ IF(BUILD_KDE4)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.KPropertiesDialog.desktop"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.ThumbCreator.desktop"
"${XATTRVIEW_NAME}.desktop"
DESTINATION "${SERVICES_INSTALL_DIR}"
DESTINATION "${KDE4_SERVICES_INSTALL_DIR}"
COMPONENT "plugin"
)
# FIXME: Run kbuildsycoca4?
# Service menus
INSTALL(FILES ../servicemenus/rp-convert-to-png.desktop
DESTINATION "${SERVICES_INSTALL_DIR}/ServiceMenus"
DESTINATION "${KDE4_SERVICES_INSTALL_DIR}/ServiceMenus"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT "plugin")