### Install Executable Source: https://github.com/frameworks/kcmutils/blob/master/src/kcmshell/CMakeLists.txt Installs the 'kcmshell6' executable using default KDE installation arguments. This makes the executable available in the system's PATH after installation. ```cmake install(TARGETS kcmshell6 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ``` -------------------------------- ### Configure kcmdesktopfilegenerator build and installation Source: https://github.com/frameworks/kcmutils/blob/master/tools/CMakeLists.txt Defines the executable target, links necessary Qt dependencies, and sets up installation rules for the KCM metadata generator. ```cmake # SPDX-FileCopyrightText: 2022 Alexander Lohnau # SPDX-License-Identifier: BSD-3-Clause add_executable(kcmdesktopfilegenerator kcmmetadatagenerator.cpp) add_executable(KF6::kcmdesktopfilegenerator ALIAS kcmdesktopfilegenerator ) target_link_libraries(kcmdesktopfilegenerator Qt::Core) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6KCMUtils") install(TARGETS kcmdesktopfilegenerator EXPORT KF6KCMUtilsToolingTargets DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF}) install(EXPORT KF6KCMUtilsToolingTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF6KCMUtilsToolingTargets.cmake NAMESPACE KF6::) ``` -------------------------------- ### Add KCM Plugin Source: https://github.com/frameworks/kcmutils/blob/master/autotests/fakekcm/CMakeLists.txt Use kcoreaddons_add_plugin to define a KCM plugin. Ensure correct installation namespace for Plasma System Settings. ```cmake kcoreaddons_add_plugin(fakekcm SOURCES fakekcm.cpp INSTALL_NAMESPACE "plasma/kcms/systemsettings_qwidgets") ``` -------------------------------- ### Generate KCM Desktop File Source: https://github.com/frameworks/kcmutils/blob/master/autotests/fakekcm/CMakeLists.txt Use kcmutils_generate_desktop_file to automatically create the .desktop file for your KCM module. ```cmake kcmutils_generate_desktop_file(fakekcm) ``` -------------------------------- ### Define Executable and Compile Definitions Source: https://github.com/frameworks/kcmutils/blob/master/src/kcmshell/CMakeLists.txt Defines the 'kcmshell6' executable and sets the project version as a compile definition. This is a standard CMake practice for setting up executables and their associated build-time configurations. ```cmake add_executable(kcmshell6 main.cpp) target_compile_definitions(kcmshell6 PRIVATE -DPROJECT_VERSION="${KF_VERSION}") ``` -------------------------------- ### Link Libraries for kcmshell6 Source: https://github.com/frameworks/kcmutils/blob/master/src/kcmshell/CMakeLists.txt Links the 'kcmshell6' executable against several libraries, including KCMUtils, I18n, Qml, and a static kcmutils logging library. This ensures that all necessary components are available at link time. ```cmake target_link_libraries(kcmshell6 KF6KCMUtils KF6::I18n Qt6::Qml kcmutils_logging_STATIC ) ``` -------------------------------- ### Link Libraries for KCM Target Source: https://github.com/frameworks/kcmutils/blob/master/autotests/qmlkcm/CMakeLists.txt Link the required Qt and KF6 libraries to your KCM target. Ensure all necessary modules are included. ```cmake target_link_libraries(kcm_testqml Qt6::Core KF6::CoreAddons KF6::I18n KF6KCMUtilsQuick ) ``` -------------------------------- ### Link KCM Plugin Libraries Source: https://github.com/frameworks/kcmutils/blob/master/autotests/fakekcm/CMakeLists.txt Link the necessary KCMUtils and CoreAddons libraries to your KCM plugin target. ```cmake target_link_libraries(fakekcm PRIVATE KF6KCMUtils KF6::CoreAddons) ``` -------------------------------- ### Generate KCM Module Data with CMake Source: https://github.com/frameworks/kcmutils/blob/master/autotests/module_data_codegen/CMakeLists.txt Use this macro to generate module data classes from KCFG settings. Ensure the necessary template files are included from the KCMUtils source directory. ```cmake # SPDX-FileCopyrightText: 2021 Alexander Lohnau # SPDX-License-Identifier: BSD-2-Clause include(../../KF6KCMUtilsMacros.cmake) set(_KCMODULE_DATA_TEMPLATE_CPP "../../src/kcmutilsgeneratemoduledata.cpp.in") set(_KCMODULE_DATA_TEMPLATE_H "../../src/kcmutilsgeneratemoduledata.h.in") set(module_data_test_SRCS module_data_test.cpp) kcmutils_generate_module_data( module_data_test_SRCS MODULE_DATA_HEADER cursorthemedata.h MODULE_DATA_CLASS_NAME CursorThemeData SETTINGS_HEADERS cursorthemesettings.h SETTINGS_CLASSES CursorThemeSettings NAMESPACE Test ) kconfig_add_kcfg_files(module_data_test_SRCS cursorthemesettings.kcfgc GENERATE_MOC) ecm_add_test(${module_data_test_SRCS} TEST_NAME module_data_test LINK_LIBRARIES KF6KCMUtils Qt6::Test ) ``` -------------------------------- ### Add QML KCM to CMake Project Source: https://github.com/frameworks/kcmutils/blob/master/autotests/qmlkcm/CMakeLists.txt Use this function to add a QML KCM to your CMake build. Specify the target name and the source files. ```cmake kcmutils_add_qml_kcm(kcm_testqml SOURCES timesettings.cpp) ``` -------------------------------- ### Mark Non-GUI Executable Source: https://github.com/frameworks/kcmutils/blob/master/src/kcmshell/CMakeLists.txt Marks 'kcmshell6' as a non-GUI executable using the ecm_mark_nongui_executable macro. This is part of the Extra CMake Modules (ECM) integration for KDE projects. ```cmake ecm_mark_nongui_executable(kcmshell6) ``` -------------------------------- ### Conditional QtDBus Linking Source: https://github.com/frameworks/kcmutils/blob/master/src/kcmshell/CMakeLists.txt Conditionally links the QtDBus library and sets a compile definition based on the HAVE_QTDBUS flag. This allows the build to adapt to the presence or absence of QtDBus support. ```cmake if (HAVE_QTDBUS) target_link_libraries(kcmshell6 Qt6::DBus) target_compile_definitions(kcmshell6 PRIVATE -DHAVE_QTDBUS=1) else() target_compile_definitions(kcmshell6 PRIVATE -DHAVE_QTDBUS=0) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.