1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5\group cmake-commands-qtdbus
6\title CMake Commands in Qt6 DBus
7\brief Lists CMake commands defined in Qt6::DBus.
9The following CMake commands are defined when Qt6::DBus is loaded, for instance
13find_package(Qt6 REQUIRED COMPONENTS DBus)
16\sa{CMake Command Reference}
20\page qtdbus-cmake-qt-add-dbus-interface.html
21\ingroup cmake-commands-qtdbus
23\title qt_add_dbus_interface
24\keyword qt6_add_dbus_interface
26\summary {Generates C++ sources implementing an interface for a D-Bus interface
29\include cmake-find-package-dbus.qdocinc
36qt_add_dbus_interface(<VAR> dbus_spec basename)
39\versionlessCMakeCommandsNote qt6_add_dbus_interface()
43Generates C++ sources implementing an interface for a D-Bus interface description
44file defined in \c{dbus_spec}. The generated files are named after \c{basename}:
45\c{basename.h}, \c{basename.cpp}, \c{basename.moc}. The paths of the files
46are added to \c{<VAR>}.
48The function sets up a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
49in interface (proxy) mode. By default, \c{qdbusxml2cpp} generates a C++
50class named after the interface name, with a namespaced alias:
54 \li D-Bus Interface Name
58 \li \c{org.example.chat}
59 \li \c{OrgExampleChatInterface}
60 \li \c{org.example.chat}
65Options can be set using \c set_source_files_properties on the \c dbus_spec:
75 \li Override the default interface class name with \c{class_name}.
79 \li Do not generate the namespaced name if set to \c{ON}.
83 \li Add an \c{#include "path"} in the generated code.
88\page qtdbus-cmake-qt-add-dbus-interfaces.html
89\ingroup cmake-commands-qtdbus
91\title qt_add_dbus_interfaces
92\keyword qt6_add_dbus_interfaces
94\summary {Generates C++ sources implementing interfaces for D-Bus interface
97\include cmake-find-package-dbus.qdocinc
104qt_add_dbus_interfaces(<VAR> dbus_spec1 [dbus_spec2 ...])
107\versionlessCMakeCommandsNote qt6_add_dbus_interfaces()
111Generates C++ sources implementing D-Bus interfaces defined in \c{dbus_spec1},
112\c{dbus_spec2}, where each argument needs to be the path to a valid D-Bus
113interface description file. The paths of the generated files are added to
116For each argument, a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
117in interface (proxy) mode is set up.
119The generated C++ source files are named after the XML file: For the file
120\c{org.example.chat.xml} the generated header will be named
121\c{orgexamplechatinterface.h}.
125Options can be set using \c set_source_files_properties on each of the file
136 \li Override the default interface class name with \c{class_name}.
140 \li Do not generate the namespaced name if set to \c{ON}.
144 \li Add an \c{#include "path"} in the generated code.
149\page qtdbus-cmake-qt-generate-dbus-interface.html
150\ingroup cmake-commands-qtdbus
152\title qt_generate_dbus_interface
153\keyword qt6_generate_dbus_interface
155\summary {Generates a D-Bus interface from a header file.}
157\include cmake-find-package-dbus.qdocinc
159\cmakecommandsince 6.0
164qt_generate_dbus_interface(header
170\versionlessCMakeCommandsNote qt6_generate_dbus_interface()
174Parses the C++ source or header file containing a QObject-derived class
175declaration and generates a file containing the D-Bus Introspection XML.
177By default, the generated XML file is stored in the current binary directory,
178and has the same base name as the header. You can specify a different name or
179path by adding \c{customName} as an optional second argument.
183The function sets up a call to the \c{qdbuscpp2xml} command line tool. Further
184arguments to the tool can be set after \c{OPTIONS}.
188\page qtdbus-cmake-qt-add-dbus-adaptor.html
189\ingroup cmake-commands-qtdbus
191\title qt_add_dbus_adaptor
192\keyword qt6_add_dbus_adaptor
194\summary {Generates an adaptor class for a D-Bus interface.}
196\include cmake-find-package-dbus.qdocinc
198\cmakecommandsince 6.0
203qt_add_dbus_adaptor(<VAR> dbus_spec header
210\versionlessCMakeCommandsNote qt6_add_dbus_adaptor()
214Generates a C++ header file implementing an adaptor for a D-Bus interface
215description file defined in \c{dbus_spec}. The path of the generated file is
216added to \c{<VAR>}. The generated adaptor class takes a pointer to
217\c{parent_class} as QObject parent. \c{parent_class} should be declared in
218\c{header}, which is included in the generated code as \c{#include "header"}.
220The function sets up a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
221in adaptor mode. The default file and class name are generated from the last
222segment in the \c{dbus_spec} base name:
230 \li \c{org.example.chat}
231 \li \c{chatadaptor.h}
236You can change the name of the header file to be generated by passing
237\c{basename} as the fifth argument. The \c{.h} suffix is always added.
239You can change the default class name by passing \c{classname} as the sixth
244\snippet cmake/examples.cmake qt_add_dbus_adaptor
248\group cmake-source-file-properties-qtdbus
249\title CMake Source File Properties in Qt6 DBus
250\brief Lists CMake file properties used in Qt6::DBus.
252\l{CMake Commands in Qt6 DBus}{CMake Commands} know about the following CMake
253source file properties:
255\sa{CMake Property Reference}
259\page cmake-source-file-property-classname.html
260\ingroup cmake-source-file-properties-qtdbus
263\target cmake-source-file-property-CLASSNAME
265\summary {Overrides the default interface class name.}
267\cmakepropertysince 5.0
269When this property is set, the generated C++ class name is overridden
270with the provided property value.
272\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
276\page cmake-source-file-property-include.html
277\ingroup cmake-source-file-properties-qtdbus
280\target cmake-source-file-property-INCLUDE
282\summary {Adds an include path.}
284\cmakepropertysince 5.0
286When this property is set, an #include "path" is added
287to the generated C++ file.
289\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
293\page cmake-source-file-property-no-namespace.html
294\ingroup cmake-source-file-properties-qtdbus
297\target cmake-source-file-property-NO_NAMESPACE
299\summary {Disables generation of a namespaced name.}
301\cmakepropertysince 5.0
303When this property is set, the generated C++ class will not contain a namespaced alias.
305\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}