AUTOMOC_PATH_PREFIX.rst 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. AUTOMOC_PATH_PREFIX
  2. -------------------
  3. When this property is ``ON``, CMake will generate the ``-p`` path prefix
  4. option for ``moc`` on :prop_tgt:`AUTOMOC` enabled Qt targets.
  5. To generate the path prefix, CMake tests if the header compiled by ``moc``
  6. is in any of the target
  7. :command:`include directories <target_include_directories>`. If so, CMake will
  8. compute the relative path accordingly. If the header is not in the
  9. :command:`include directories <target_include_directories>`, CMake will omit
  10. the ``-p`` path prefix option. ``moc`` usually generates a
  11. relative include path in that case.
  12. :prop_tgt:`AUTOMOC_PATH_PREFIX` is initialized from the variable
  13. :variable:`CMAKE_AUTOMOC_PATH_PREFIX`, which is ``OFF`` by default.
  14. See the :manual:`cmake-qt(7)` manual for more information on using CMake
  15. with Qt.
  16. Reproducible builds
  17. ^^^^^^^^^^^^^^^^^^^
  18. For reproducible builds it is recommended to keep headers that are ``moc``
  19. compiled in one of the target
  20. :command:`include directories <target_include_directories>` and set
  21. :prop_tgt:`AUTOMOC_PATH_PREFIX` to ``ON``. This ensures that:
  22. - ``moc`` output files are identical on different build setups,
  23. - ``moc`` output files will compile correctly when the source and/or
  24. build directory is a symbolic link.