1GENERATED
2---------
3
4Is this source file generated as part of the build or CMake process.
5
6.. versionchanged:: 3.20
7  The GENERATED source file property is now visible in all directories.
8
9Tells the internal CMake engine that a source file is generated by an outside
10process such as another build step, or the execution of CMake itself.
11This information is then used to exempt the file from any existence or
12validity checks.
13
14Any file that is
15
16- created by the execution of commands such as
17  :command:`add_custom_command` and :command:`file(GENERATE)`
18- listed as one of the ``BYPRODUCTS`` of an :command:`add_custom_command`
19  or :command:`add_custom_target` command, or
20- created by a CMake ``AUTOGEN`` operation such as :prop_tgt:`AUTOMOC`,
21  :prop_tgt:`AUTORCC`, or :prop_tgt:`AUTOUIC`
22
23will be marked with the ``GENERATED`` property.
24
25When a generated file created as the ``OUTPUT`` of an
26:command:`add_custom_command` command is explicitly listed as a source file
27for any target in the same directory scope (which usually means the same
28``CMakeLists.txt`` file), CMake will automatically create a dependency to
29make sure the file is generated before building that target.
30
31The :ref:`Makefile Generators` will remove ``GENERATED`` files during
32``make clean``.
33
34Generated sources may be hidden in some IDE tools, while in others they might
35be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMOC`,
36:prop_tgt:`AUTORCC` or :prop_tgt:`AUTOUIC` functionality, the
37:prop_gbl:`AUTOGEN_SOURCE_GROUP`, :prop_gbl:`AUTOMOC_SOURCE_GROUP`,
38:prop_gbl:`AUTORCC_SOURCE_GROUP` and :prop_gbl:`AUTOUIC_SOURCE_GROUP` target
39properties may influence where the generated sources are grouped in the project's
40file lists.
41
42.. note::
43
44  Starting with CMake 3.20 the ``GENERATED`` source file property can be set
45  and retrieved from any directory scope. It is an all-or-nothing property.
46  It also can no longer be removed or unset if it was set to ``TRUE``. Policy
47  :policy:`CMP0118` was introduced to allow supporting the ``OLD`` behavior
48  for some time.
49