# CMP0118

New in version 3.20.

`GENERATED` sources may be used across directories without manual marking.

In CMake 3.19 and below, the `GENERATED` source file property, like other source file properties, was scoped in every directory separately. If a source file was generated in one directory, projects had to manually set the `GENERATED` property in another directory in order to use the file.

Whether or not a source file is generated is an all-or-nothing global property of the source: a source is either generated or it is not. CMake 3.20 and above prefer to allow source files generated in one directory to be used in other directories without manually marking them as `GENERATED`. Additionally, the `GENERATED` property may now be set only to boolean values, and may not be turned off once turned on. This policy provides compatibility for projects that have not been updated for this behavior.

The `OLD` behavior of this policy is to allow generated files to be used only in directories in which their `GENERATED` property has been turned on. The `NEW` behavior of this policy is to allow generated files to be used in other directories without explicitly turning on the `GENERATED` property for those directories.

This policy was introduced in CMake version 3.20. It may be set by `cmake_policy()` or `cmake_minimum_required()`. If it is not set, CMake warns about setting the `GENERATED` property to a non-boolean value, and uses `OLD` behavior.

Note

The `OLD` behavior of a policy is `deprecated by definition` and may be removed in a future version of CMake.