Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qt_wrap_cpp.qdoc
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt-wrap-cpp.html
6\ingroup cmake-commands-qtcore
7
8\title qt_wrap_cpp
9\keyword qt6_wrap_cpp
10
11\summary {Creates .moc files from sources.}
12
13\include cmake-find-package-core.qdocinc
14
15\cmakecommandsince 5.0
16
17\section1 Synopsis
18
19\badcode
20qt_wrap_cpp(<VAR> src_file1 [src_file2 ...]
21 [TARGET target]
22 [OPTIONS ...]
23 [DEPENDS ...])
24\endcode
25
26\versionlessCMakeCommandsNote qt6_wrap_cpp()
27
28\section1 Description
29
30Creates rules for calling the \l{moc}{Meta-Object Compiler (moc)} on the given
31source files. For each input file, an output file is generated in the build
32directory. The paths of the generated files are added to \c{<VAR>}.
33
34\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a
35more convenient way to let source files be processed with \c{moc}.
36
37\section1 Arguments
38
39You can set an explicit \c{TARGET}. This will make sure that the target
40properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used
41when scanning the source files with \c{moc}.
42
43You can set additional \c{OPTIONS} that should be added to the \c{moc} calls.
44You can find possible options in the \l{moc}{moc documentation}.
45
46\c{DEPENDS} allows you to add additional dependencies for recreation of the
47generated files. This is useful when the sources have implicit dependencies,
48like code for a Qt plugin that includes a \c{.json} file using the
49Q_PLUGIN_METADATA() macro.
50
51\section1 Examples
52
53\snippet cmake-macros/examples.cmake qt_wrap_cpp
54*/