GENERATED.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. GENERATED
  2. ---------
  3. Is this source file generated as part of the build or CMake process.
  4. .. versionchanged:: 3.20
  5. Turning on the ``GENERATED`` source file property in one directory allows
  6. the associated source file to be used across directories without the need
  7. to manually setting that property for other directory scopes, too.
  8. Additionally, it may now be set only to boolean values, and may not be
  9. turned off once turned on. See policy :policy:`CMP0118`.
  10. .. versionchanged:: 3.30
  11. Whether or not a source file is generated is an all-or-nothing global
  12. property of the source. Consequently, the ``GENERATED`` source file
  13. property is now visible in all directories. See policy :policy:`CMP0163`.
  14. Tells the internal CMake engine that a source file is generated by an outside
  15. process such as another build step, or the execution of CMake itself.
  16. This information is then used to exempt the file from any existence or
  17. validity checks.
  18. Any file that is
  19. - created by the execution of commands such as
  20. :command:`add_custom_command` which run during the build
  21. - listed as one of the ``BYPRODUCTS`` of an :command:`add_custom_command`
  22. or :command:`add_custom_target` command, or
  23. - created by a CMake ``AUTOGEN`` operation such as :prop_tgt:`AUTOMOC`,
  24. :prop_tgt:`AUTORCC`, or :prop_tgt:`AUTOUIC`
  25. will be marked with the ``GENERATED`` property.
  26. When a generated file created as the ``OUTPUT`` of an
  27. :command:`add_custom_command` command is explicitly listed as a source file
  28. for any target in the same directory scope (which usually means the same
  29. ``CMakeLists.txt`` file), CMake will automatically create a dependency to
  30. make sure the file is generated before building that target.
  31. The :ref:`Makefile Generators` will remove ``GENERATED`` files during
  32. ``make clean``.
  33. Generated sources may be hidden in some IDE tools, while in others they might
  34. be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMOC`,
  35. :prop_tgt:`AUTORCC` or :prop_tgt:`AUTOUIC` functionality, the
  36. :prop_gbl:`AUTOGEN_SOURCE_GROUP`, :prop_gbl:`AUTOMOC_SOURCE_GROUP`,
  37. :prop_gbl:`AUTORCC_SOURCE_GROUP` and :prop_gbl:`AUTOUIC_SOURCE_GROUP` target
  38. properties may influence where the generated sources are grouped in the project's
  39. file lists.