qt5_generate_moc

概要

qt5_generate_moc(src_file dest_file
                 [TARGET target])
					
					

描述

创建规则以调用 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 . qt5_wrap_cpp is also similar, but automatically generates a temporary file path for you.

注意: 为兼容 Qt 6,命令还可用于名称 qt_generate_moc .

自变量

可以明确设置 TARGET . This will make sure that the target properties INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS are also used when scanning the source files with moc .

范例

qt5_generate_moc(main.cpp main.moc TARGET myapp)