AUTOMOC_MACRO_NAMES.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. AUTOMOC_MACRO_NAMES
  2. -------------------
  3. A :ref:`;-list <CMake Language Lists>` list of macro names used by
  4. :prop_tgt:`AUTOMOC` to determine if a C++ file needs to be processed by ``moc``.
  5. This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
  6. for this target.
  7. When running :prop_tgt:`AUTOMOC`, CMake searches for the strings listed in
  8. :prop_tgt:`AUTOMOC_MACRO_NAMES` in C++ source and header files.
  9. If any of the strings is found
  10. - as the first non space string on a new line or
  11. - as the first non space string after a ``{`` on a new line,
  12. then the file will be processed by ``moc``.
  13. By default :prop_tgt:`AUTOMOC_MACRO_NAMES` is initialized from
  14. :variable:`CMAKE_AUTOMOC_MACRO_NAMES`.
  15. See the :manual:`cmake-qt(7)` manual for more information on using CMake
  16. with Qt.
  17. Example
  18. ^^^^^^^
  19. In this case the the ``Q_OBJECT`` macro is hidden inside an other macro
  20. called ``CUSTOM_MACRO``. To let CMake know that source files, that contain
  21. ``CUSTOM_MACRO``, need to be ``moc`` processed, we call::
  22. set_property(TARGET tgt APPEND PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO")