### Plasma Applet Installation Source: https://github.com/kde/plasma-framework/blob/master/templates/plasma6-wallpaper-with-qml-extension/CMakeLists.txt Installs the Plasma wallpaper applet package with the specified name and type. ```cmake # wallpaper applet # TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README) plasma_install_package(package org.kde.plasma.%{APPNAMELC} wallpapers wallpaper) ``` -------------------------------- ### Install QML Files for KirigamiPlasmaStyle Source: https://github.com/kde/plasma-framework/blob/master/src/declarativeimports/kirigamiplasmastyle/CMakeLists.txt Installs QML files for KirigamiPlasmaStyle to the QML directory. ```cmake install(FILES AbstractApplicationHeader.qml Icon.qml DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami/styles/Plasma ) ``` -------------------------------- ### Install CMake Configuration Files Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Installs the generated PlasmaQuickConfig.cmake and PlasmaQuickConfigVersion.cmake files to the package configuration directory. ```cmake install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PlasmaQuickConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/PlasmaQuickConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) ``` -------------------------------- ### Install PlasmaQuick Target and Exports Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Installs the PlasmaQuick target and its export definitions for use by other projects. ```cmake install(TARGETS PlasmaQuick EXPORT PlasmaQuickTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ``` -------------------------------- ### Install KirigamiPlasmaStyle Target Source: https://github.com/kde/plasma-framework/blob/master/src/declarativeimports/kirigamiplasmastyle/CMakeLists.txt Installs the KirigamiPlasmaStyle target to the plugin directory. ```cmake install(TARGETS KirigamiPlasmaStyle DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/kirigami/platform) ``` -------------------------------- ### Install Theme Assets Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Installs the generated metadata file and plasmarc configuration. Ensure PLASMA_DATA_INSTALL_DIR is correctly set. ```cmake install( FILES "${CMAKE_CURRENT_BINARY_DIR}/metadata.json" plasmarc DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default ) ``` -------------------------------- ### Install PlasmaQuick Development Headers Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Installs the generated export header and CamelCase headers to the development include directory. ```cmake install( FILES ${plasmaquick_LIB_INCLUDES} DESTINATION ${PLASMAQUICK_INSTALL_INCLUDEDIR}/plasmaquick COMPONENT Devel ) install( FILES ${PlasmaQuick_CamelCase_HEADERS} DESTINATION ${PLASMAQUICK_INSTALL_INCLUDEDIR}/PlasmaQuick COMPONENT Devel ) ``` -------------------------------- ### Install Export Targets for PlasmaQuick Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Installs the PlasmaQuickTargets export file, defining the namespace for PlasmaQuick targets. ```cmake install(EXPORT PlasmaQuickTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE PlasmaQuickTargets.cmake NAMESPACE Plasma:: ) ``` -------------------------------- ### Install Widget SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/oxygen/CMakeLists.txt Finds all SVG files in the 'widgets' subdirectory and installs them as part of the Oxygen desktop theme. ```cmake FILE(GLOB widgets widgets/*.svg) plasma_install_desktoptheme_svgs(oxygen SUBPATH widgets FILES ${widgets}) ``` -------------------------------- ### Configure Package Installation Directory Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Sets the installation directory for the PlasmaQuick CMake configuration files. ```cmake set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/PlasmaQuick") ``` -------------------------------- ### Finalize QML Module Installation Source: https://github.com/kde/plasma-framework/blob/master/src/declarativeimports/plasmaextracomponents/CMakeLists.txt Installs the QML module to the specified destination directory. ```cmake ecm_finalize_qml_module(plasmaextracomponentsplugin DESTINATION ${KDE_INSTALL_QMLDIR}) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/kde/plasma-framework/blob/master/templates/cpp-plasmoid6/CMakeLists.txt Initializes CMake version, project name, and sets minimum required versions for Qt and KF6. This is standard for KDE Plasma 6 projects. ```cmake cmake_minimum_required(VERSION 3.16) project(plasma-%{APPNAMELC}) ``` -------------------------------- ### Install Applet Plugin Source: https://github.com/kde/plasma-framework/blob/master/templates/cpp-plasmoid6/src/CMakeLists.txt Installs the compiled applet library to the Plasma applet plugin directory. This makes the applet available for use in the Plasma desktop environment. ```cmake install(TARGETS org.kde.plasma.%{APPNAMELC} DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets) ``` -------------------------------- ### Install Opaque Widget SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/oxygen/CMakeLists.txt Finds all SVG files in the 'opaque/widgets' subdirectory and installs them as part of the Oxygen desktop theme. ```cmake FILE(GLOB opaque opaque/widgets/*.svg) plasma_install_desktoptheme_svgs(oxygen SUBPATH opaque/widgets FILES ${opaque}) ``` -------------------------------- ### Define PlasmaQuick Install Include Directory Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Sets the installation directory for PlasmaQuick headers, ensuring they are placed under the PlasmaQuick subdirectory within the main include directory. ```cmake set(PLASMAQUICK_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR}/PlasmaQuick") ``` -------------------------------- ### Basic CMakeLists.txt for Plasma Plasmoid Source: https://github.com/kde/plasma-framework/blob/master/templates/qml-plasmoid6/CMakeLists.txt Sets up the minimum CMake version, project name, and finds necessary packages like ECM and Plasma. It then defines the installation path for the plasmoid package. ```cmake cmake_minimum_required(VERSION 3.16) project(plasma-%{APPNAMELC}) find_package(ECM 1.4.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) find_package(Plasma REQUIRED) # TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README) plasma_install_package(package org.kde.plasma.%{APPNAMELC}) ``` -------------------------------- ### Finalize QML Module Installation Source: https://github.com/kde/plasma-framework/blob/master/src/declarativeimports/core/CMakeLists.txt Finalizes the QML module and installs it to the specified destination directory. ```cmake ecm_finalize_qml_module(corebindingsplugin DESTINATION ${KDE_INSTALL_QMLDIR}) ``` -------------------------------- ### Install Dialog SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/oxygen/CMakeLists.txt Finds all SVG files in the 'dialogs' subdirectory and installs them as part of the Oxygen desktop theme. ```cmake FILE(GLOB dialogs dialogs/*.svg) plasma_install_desktoptheme_svgs(oxygen SUBPATH dialogs FILES ${dialogs}) ``` -------------------------------- ### Install Package Structures from Source Files Source: https://github.com/kde/plasma-framework/blob/master/src/plasma/packagestructure/CMakeLists.txt Calls to install package structures from specific source files using the install_package_structure_source function. ```cmake install_package_structure_source(plasma_wallpaper qmlWallpaper/wallpaper.cpp) install_package_structure_source(plasma_shell shell/shellpackage.cpp) ``` -------------------------------- ### Setup Version Information for PlasmaQuick Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Configures versioning information for the PlasmaQuick package, including SOVERSION and generating a version configuration file. ```cmake ecm_setup_version(${PLASMA_VERSION} VARIABLE_PREFIX PLASMAQUICK SOVERSION 6 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/PlasmaQuickConfigVersion.cmake" ) ``` -------------------------------- ### CMakeLists.txt Configuration for Plasma Wallpaper Plugin Source: https://github.com/kde/plasma-framework/blob/master/templates/plasma6-wallpaper-with-qml-extension/plugin/CMakeLists.txt This snippet defines the build process for a Plasma 6 wallpaper plugin. It sets up library targets, links necessary dependencies like KF6::I18n and Qt6 modules, and specifies installation directories for the plugin and its QML module definition. ```cmake add_definitions(-DTRANSLATION_DOMAIN="plasma_wallpaper_org.kde.plasma.%{APPNAMELC}") add_library(%{APPNAMELC}plugin SHARED %{APPNAMELC}plugin.cpp) target_link_libraries(%{APPNAMELC}plugin KF6::I18n Qt6::Gui Qt6::Qml ) install(TARGETS %{APPNAMELC}plugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/%{APPNAMELC}) install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/%{APPNAMELC}) ``` -------------------------------- ### CMakeLists.txt for Plasma Wallpaper Source: https://github.com/kde/plasma-framework/blob/master/templates/plasma6-wallpaper/CMakeLists.txt This snippet sets up the CMake build system for a Plasma 6 wallpaper. It defines the minimum CMake version, project name, finds required KDE Frameworks like ECM and Plasma, and configures the installation of the wallpaper package. ```cmake cmake_minimum_required(VERSION 3.16) project(plasma-%{APPNAMELC}) find_package(ECM 1.4.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) find_package(Plasma REQUIRED) # TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README) plasma_install_package(package org.kde.plasma.%{APPNAMELC} wallpapers wallpaper) ``` -------------------------------- ### Install Specific Package Structures Source: https://github.com/kde/plasma-framework/blob/master/src/plasma/packagestructure/CMakeLists.txt Calls to install various predefined package structures using the install_package_structure function. ```cmake install_package_structure(plasma_generic) install_package_structure(plasma_applet) install_package_structure(plasma_theme) install_package_structure(plasma_containmentactions) ``` -------------------------------- ### Configure Package Configuration File Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Generates the PlasmaQuickConfig.cmake file from a template, specifying installation paths. ```cmake configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/PlasmaQuickConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PlasmaQuickConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} PATH_VARS PLASMAQUICK_INSTALL_INCLUDEDIR CMAKE_INSTALL_PREFIX ) ``` -------------------------------- ### Install Theme Assets Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/oxygen/CMakeLists.txt Installs theme-related files, including the generated metadata JSON and specific assets, to the designated Plasma data directory. ```cmake install( FILES colors "${CMAKE_CURRENT_BINARY_DIR}/metadata.json" plasmarc DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen ) ``` -------------------------------- ### Install General Icons Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Installs general SVG icons into the theme's icons subdirectory. Uses FILE(GLOB) to find all .svg files. ```cmake FILE(GLOB icons icons/*.svg) plasma_install_desktoptheme_svgs(default SUBPATH icons FILES ${icons}) ``` -------------------------------- ### Install Opaque Dialog SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/oxygen/CMakeLists.txt Finds all SVG files in the 'opaque/dialogs' subdirectory and installs them as part of the Oxygen desktop theme. ```cmake FILE(GLOB opaque opaque/dialogs/*.svg) plasma_install_desktoptheme_svgs(oxygen SUBPATH opaque/dialogs FILES ${opaque}) ``` -------------------------------- ### Install Plasma Package Source: https://github.com/kde/plasma-framework/blob/master/templates/cpp-plasmoid6/src/CMakeLists.txt Uses a custom CMake function to install the Plasma package, ensuring it's correctly registered and discoverable by the Plasma desktop. ```cmake plasma_install_package(package org.kde.plasma.%{APPNAMELC}) ``` -------------------------------- ### Install Package Structure Source Function Source: https://github.com/kde/plasma-framework/blob/master/src/plasma/packagestructure/CMakeLists.txt Defines a CMake function to add and install a plugin from a specified source file, linking against the KF6::Package library. ```cmake function(install_package_structure_source name source) kcoreaddons_add_plugin(${name} SOURCES ${source} INSTALL_NAMESPACE "kf6/packagestructure") target_link_libraries(${name} KF6::Package) endfunction() ``` -------------------------------- ### Install Solid Widget SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Installs solid SVG files for widgets into the theme's solid/widgets subdirectory. Uses FILE(GLOB) to find all .svg files. ```cmake FILE(GLOB solid_widgets solid/widgets/*.svg) plasma_install_desktoptheme_svgs(default SUBPATH solid/widgets FILES ${solid_widgets}) ``` -------------------------------- ### Install Solid Dialog SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Installs solid SVG files for dialogs into the theme's solid/dialogs subdirectory. Uses FILE(GLOB) to find all .svg files. ```cmake FILE(GLOB solid_dialogs solid/dialogs/*.svg) plasma_install_desktoptheme_svgs(default SUBPATH solid/dialogs FILES ${solid_dialogs}) ``` -------------------------------- ### Configure GZIP Compression Option Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/CMakeLists.txt Sets up an option to enable GZIP compression for SVG files during installation. It conditionally finds the necessary compression tools (7z or gzip) based on the operating system. ```cmake option(GZIP_DESKTOPTHEME_SVG "Install Desktop Theme SVG files as .svgz." ON) if (GZIP_DESKTOPTHEME_SVG) if(WIN32) find_package(7z) set_package_properties(7z PROPERTIES TYPE REQUIRED ) else() find_package(gzip) set_package_properties(gzip PROPERTIES TYPE REQUIRED ) endif() endif() ``` -------------------------------- ### Find and Configure QML Source Files Source: https://github.com/kde/plasma-framework/blob/master/src/declarativeimports/CMakeLists.txt Locates all QML files within the 'plasmacomponents3' directory and its subdirectories. Each found file is then processed by 'configure_file' to replace placeholders like @QQC2_VERSION@ with actual values. ```cmake FILE(GLOB_RECURSE inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/plasmacomponents3/*") #for each file, replace @QQC2_VERSION@ with the version we found FOREACH(infileName ${inFiles}) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/${infileName}" "${CMAKE_CURRENT_BINARY_DIR}/${infileName}" @ONLY ) ENDFOREACH(infileName) ``` -------------------------------- ### Install Package Structure Function Source: https://github.com/kde/plasma-framework/blob/master/src/plasma/packagestructure/CMakeLists.txt Defines a CMake function to add and install a plugin for package structure, linking against a static library. ```cmake function(install_package_structure name) kcoreaddons_add_plugin(${name} SOURCES ${name}_packagestructure.cpp INSTALL_NAMESPACE "kf6/packagestructure") target_link_libraries(${name} plasma_packagestructure_static) endfunction() ``` -------------------------------- ### Include Subdirectories for Themes Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/CMakeLists.txt Includes subdirectories for specific theme variants like oxygen, breeze, breeze-dark, and breeze-light. ```cmake add_subdirectory( oxygen ) add_subdirectory( breeze ) add_subdirectory( breeze-dark ) add_subdirectory( breeze-light ) ``` -------------------------------- ### Add QML Sources Source: https://github.com/kde/plasma-framework/blob/master/src/declarativeimports/plasmaextracomponents/CMakeLists.txt Includes QML files for the main plugin sources. ```cmake ecm_target_qml_sources(plasmaextracomponentsplugin SOURCES qml/ActionTextField.qml qml/BasicPlasmoidHeading.qml qml/DescriptiveLabel.qml qml/ExpandableListItem.qml qml/Heading.qml qml/Highlight.qml qml/ListItem.qml qml/ModelContextMenu.qml qml/PasswordField.qml qml/PlaceholderMessage.qml qml/PlasmoidHeading.qml qml/Representation.qml qml/SearchField.qml qml/ShadowedLabel.qml ) ``` -------------------------------- ### Install Widget SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Installs SVG files for widgets into the theme's widget subdirectory. Uses FILE(GLOB) to find all .svg files. ```cmake FILE(GLOB widgets widgets/*.svg) plasma_install_desktoptheme_svgs(default SUBPATH widgets FILES ${widgets}) ``` -------------------------------- ### Create Plasma Applet Library Source: https://github.com/kde/plasma-framework/blob/master/templates/cpp-plasmoid6/src/CMakeLists.txt Defines the applet as a loadable module library. Ensure the source file (e.g., applet.cpp) is listed correctly. ```cmake add_library(org.kde.plasma.%{APPNAMELC} MODULE %{APPNAMELC}.cpp) ``` -------------------------------- ### Install Dialog SVGs Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Installs SVG files for dialogs into the theme's dialogs subdirectory. Uses FILE(GLOB) to find all .svg files. ```cmake FILE(GLOB dialogs dialogs/*.svg) plasma_install_desktoptheme_svgs(default SUBPATH dialogs FILES ${dialogs}) ``` -------------------------------- ### Configure Metadata File Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/breeze/CMakeLists.txt Copies and configures a metadata template file to the build directory. Use this to generate theme-specific metadata. ```cmake configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/metadata.json.cmake" "${CMAKE_CURRENT_BINARY_DIR}/metadata.json" @ONLY ) ``` -------------------------------- ### Set PlasmaQuick Include Directories Source: https://github.com/kde/plasma-framework/blob/master/src/plasmaquick/CMakeLists.txt Configures public and interface include directories for the PlasmaQuick target, including build-time and install-time paths. ```cmake target_include_directories(PlasmaQuick PUBLIC "$" "$" # module version header ) ``` -------------------------------- ### Project and Dependency Configuration Source: https://github.com/kde/plasma-framework/blob/master/templates/plasma6-wallpaper-with-qml-extension/CMakeLists.txt Sets the minimum CMake version, project name, and finds essential build and runtime dependencies including ECM, KF6 (Plasma, I18n), and Qt6 (Qml, Gui, Core). ```cmake cmake_minimum_required(VERSION 3.16) project(plasma-%{APPNAMELC}) find_package(ECM 1.4.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) find_package(KF6 REQUIRED COMPONENTS Plasma I18n ) find_package(Qt6 CONFIG REQUIRED COMPONENTS Qml Gui Core ) ``` -------------------------------- ### Plasma Install Desktoptheme SVGS Function Source: https://github.com/kde/plasma-framework/blob/master/src/desktoptheme/CMakeLists.txt A CMake function to install SVG files for a desktop theme. It supports specifying a subpath and handles GZIP compression if enabled. ```cmake function(PLASMA_INSTALL_DESKTOPTHEME_SVGS theme_name) set(options ) set(oneValueArgs SUBPATH ) set(multiValueArgs FILES ) cmake_parse_arguments(PIDS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT DEFINED PIDS_SUBPATH) message(FATAL_ERROR "SUBPATH needs to be defined when calling plasma_install_desktoptheme_svgs.") endif() if(NOT PIDS_FILES) message(FATAL_ERROR "No files passed when calling plasma_install_desktoptheme_svgs.") endif() set(_target_name "${theme_name}_desktoptheme_graphics_${PIDS_SUBPATH}") string(REPLACE "/" "_" _target_name "${_target_name}") set(desktoptheme_COMPONENTDIR "${theme_name}/${PIDS_SUBPATH}") set(desktoptheme_INSTALLDIR ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/${desktoptheme_COMPONENTDIR}) if (GZIP_DESKTOPTHEME_SVG) set(desktoptheme_GZIPDIR "${theme_name}.gzipped/${PIDS_SUBPATH}") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${desktoptheme_GZIPDIR}") endif() set(_install_files) foreach(_src_file ${PIDS_FILES}) if (NOT IS_ABSOLUTE ${_src_file}) set(_src_file "${CMAKE_CURRENT_SOURCE_DIR}/${_src_file}") endif() if (NOT EXISTS ${_src_file}) message(FATAL_ERROR "No such file found: ${_src_file}") endif() get_filename_component(_fileName "${_src_file}" NAME) if (GZIP_DESKTOPTHEME_SVG) set(_gzipped_file_displayname "${desktoptheme_COMPONENTDIR}/${_fileName}z") set(_gzipped_file "${CMAKE_CURRENT_BINARY_DIR}/${desktoptheme_GZIPDIR}/${_fileName}z") if(WIN32) add_custom_command( OUTPUT ${_gzipped_file} COMMAND 7z::7z ARGS a -tgzip ${_gzipped_file} ${_src_file} DEPENDS ${_src_file} COMMENT "Gzipping ${_gzipped_file_displayname}" ) else() add_custom_command( OUTPUT ${_gzipped_file} COMMAND gzip::gzip ARGS -9 # compress best -n # no original name and timestamp stored, for reproducibility -c # write to stdout ${_src_file} > ${_gzipped_file} DEPENDS ${_src_file} COMMENT "Gzipping ${_gzipped_file_displayname}" ) endif() else() set(_gzipped_file "${_src_file}") endif() list(APPEND _install_files "${_gzipped_file}") endforeach() add_custom_target(${_target_name} ALL DEPENDS ${_install_files}) install(FILES ${_install_files} DESTINATION "${desktoptheme_INSTALLDIR}" ) endfunction() ```