Calls moc on an input file.
The command is defined in the
核心
組件對於
Qt6
package, which can be loaded like so:
find_package(Qt6 REQUIRED COMPONENTS Core)
This command was introduced in Qt 5.0.
qt_generate_moc(src_file dest_file
[TARGET target])
若
versionless commands
are disabled, use
qt6_generate_moc()
instead. It supports the same set of arguments as this command.
創建規則以調用
MOC (元對象編譯器)
on
src_file
並將輸齣存儲在
dest_file
.
注意:
This is a low-level macro. See the
CMake AUTOMOC Documentation
for a more convenient way to let source files be processed with
moc
.
qt_wrap_cpp
is also similar, but automatically generates a temporary file path for you.
可以明確設置
TARGET
. This will make sure that the target properties
INCLUDE_DIRECTORIES
and
COMPILE_DEFINITIONS
are also used when scanning the source files with
moc
.
qt_generate_moc(main.cpp main.moc TARGET myapp)