qt_generate_moc(src_file dest_file [TARGET target])
Creates a rule to call the Meta-Object Compiler (moc) on
src_file and store the output in
Note: 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.
This command was introduced in Qt 5.15. You can use qt5_generate_moc in older versions of Qt.
You can set an explicit
TARGET. This will make sure that the target properties
COMPILE_DEFINITIONS are also used when scanning the source files with
qt_generate_moc(main.cpp main.moc TARGET myapp)
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.