1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
6\ingroup cmake-commands-qtcore
11\summary {Creates .moc files from sources.}
13\include cmake-find-package-core.qdocinc
20qt_wrap_cpp(<VAR> src_file1 [src_file2 ...]
26\versionlessCMakeCommandsNote qt6_wrap_cpp()
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>}.
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}.
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}.
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}.
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.
53\snippet cmake-macros/examples.cmake qt_wrap_cpp