new macro plasma_install_bundled_package

more clear than an optional paramenter (there alre already 2)
and avoids the boolean trap
This commit is contained in:
Marco Martin 2018-03-20 16:52:18 +01:00
parent 7af1892632
commit dc5c609e54

View File

@ -7,6 +7,7 @@ set(PLASMA_DATA_INSTALL_DIR "${KDE_INSTALL_DATADIR}/${PLASMA_RELATIVE_DATA_INSTA
# plasma_install_package(path componentname [root] [type]) # plasma_install_package(path componentname [root] [type])
# #
# Use plasma_install_bundled_package instead.
# Installs a Plasma package to the system path # Installs a Plasma package to the system path
# @arg path The source path to install from, location of metadata.desktop # @arg path The source path to install from, location of metadata.desktop
# @arg componentname The plugin name of the component, corresponding to the # @arg componentname The plugin name of the component, corresponding to the
@ -30,17 +31,39 @@ macro(plasma_install_package dir component)
set(type applet) set(type applet)
endif() endif()
list(LENGTH extra_macro_args num_extra_args) kpackage_install_package(${dir} ${component} ${root} ${PLASMA_RELATIVE_DATA_INSTALL_DIR} NO_DEPRECATED_WARNING)
set (extra_macro_args ${ARGN})
if (${num_extra_args} EQUAL 1) install(FILES ${dir}/metadata.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} RENAME plasma-${type}-${component}.desktop)
list(GET extra_macro_args 0 bundle) endmacro()
# plasma_install_bundled_package(path componentname [root] [type])
#
# Installs a Plasma package to the system path,
# compressing all its files in a binary rcc qresources file.
# @arg path The source path to install from, location of metadata.desktop
# @arg componentname The plugin name of the component, corresponding to the
# X-KDE-PluginInfo-Name key in metadata.desktop
# @arg root The subdirectory to install to, default: plasmoids
# @arg type The type, default to applet, or applet, package, containment,
# wallpaper, shell, lookandfeel, etc.
# @see Types column in kpackagetool5 --list-types
#
# Examples:
# plasma_install_bundled_package(mywidget org.kde.plasma.mywidget) # installs an applet
# plasma_install_bundled_package(declarativetoolbox org.kde.toolbox packages package) # installs a generic package
#
macro(plasma_install_bundled_package dir component)
set(root ${ARGV2})
set(type ${ARGV3})
if(NOT root)
set(root plasmoids)
endif()
if(NOT type)
set(type applet)
endif() endif()
if(bundle) kpackage_install_bundled_package(${dir} ${component} ${root} ${PLASMA_RELATIVE_DATA_INSTALL_DIR})
kpackage_install_bundled_package(${dir} ${component} ${root} ${PLASMA_RELATIVE_DATA_INSTALL_DIR})
else()
kpackage_install_package(${dir} ${component} ${root} ${PLASMA_RELATIVE_DATA_INSTALL_DIR} NO_DEPRECATED_WARNING)
endif()
install(FILES ${dir}/metadata.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} RENAME plasma-${type}-${component}.desktop) install(FILES ${dir}/metadata.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} RENAME plasma-${type}-${component}.desktop)
endmacro() endmacro()