GENERATED prop: Introducing policy CMP0118 and its documentation

Note: This is currently only defining the CMP0118 policy and providing
its documentation, however, the implementation is still not using it.
This commit is contained in:
Deniz Bahadir 2020-11-17 20:30:53 +01:00
parent 78c8d95605
commit 0eb30f175e
9 changed files with 61 additions and 1 deletions

View File

@ -94,3 +94,8 @@ If ``BRIEF_DOCS`` or ``FULL_DOCS`` is given then the variable is set to a
string containing documentation for the requested property. If
documentation is requested for a property that has not been defined
``NOTFOUND`` is returned.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.

View File

@ -40,3 +40,8 @@ file properties usually control how the file is built. One property that is
always there is :prop_sf:`LOCATION`.
See also the more general :command:`get_property` command.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.

View File

@ -105,3 +105,8 @@ directly set in the nominated scope, the command will behave as though
See the :manual:`cmake-properties(7)` manual for a list of properties
in each scope.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.

View File

@ -36,3 +36,8 @@ See also the :command:`set_property(SOURCE)` command.
See :ref:`Source File Properties` for the list of properties known
to CMake.
.. note::
The :prop_sf:`GENERATED` source file property may be globally visible.
See its documentation for details.

View File

@ -57,6 +57,7 @@ Policies Introduced by CMake 3.20
.. toctree::
:maxdepth: 1
CMP0118: The GENERATED source file property is now visible in all directories. </policy/CMP0118>
CMP0117: MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default. </policy/CMP0117>
CMP0116: Ninja generators transform DEPFILEs from add_custom_command(). </policy/CMP0116>
CMP0115: Source file extensions must be explicit. </policy/CMP0115>

17
Help/policy/CMP0118.rst Normal file
View File

@ -0,0 +1,17 @@
CMP0118
-------
The :prop_sf:`GENERATED` source file property is now visible in all directories.
Whether or not a source file is generated is an all-or-nothing global
property of the source. Consequently, the associated ``GENERATED``
property is now visible from any directory scope, not only from the scope
for which it was set.
The ``OLD`` behavior of this policy is to only allow ``GENERATED`` to be
visible from the directory scope for which it was set. The ``NEW``
behavior on the other hand allows it to be visible from any scope.
This policy was introduced in CMake version 3.20. CMake version |release|
warns when the policy is not set and uses ``OLD`` behavior. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.

View File

@ -3,6 +3,9 @@ GENERATED
Is this source file generated as part of the build or CMake process.
.. versionchanged:: 3.20
The GENERATED source file property is now visible in all directories.
Tells the internal CMake engine that a source file is generated by an outside
process such as another build step, or the execution of CMake itself.
This information is then used to exempt the file from any existence or
@ -34,3 +37,11 @@ or :prop_tgt:`AUTORCC` functionality, the :prop_gbl:`AUTOGEN_SOURCE_GROUP`,
:prop_gbl:`AUTOMOC_SOURCE_GROUP` and :prop_gbl:`AUTORCC_SOURCE_GROUP` target
properties may influence where the generated sources are grouped in the project's
file lists.
.. note::
Starting with CMake 3.20 the ``GENERATED`` source file property can be set
and retrieved from any directory scope. It is an all-or-nothing property.
It also can no longer be removed or unset if it was set to ``TRUE``. Policy
:policy:`CMP0118` was introduced to allow supporting the ``OLD`` behavior
for some time.

View File

@ -0,0 +1,7 @@
make-GENERATED-visible-from-any-scope
-------------------------------------
* The :prop_sf:`GENERATED` source-file property is now visible
from any directory scope, regardles in which scope or for what
scope it was set.
See policy :policy:`CMP0118`.

View File

@ -348,7 +348,11 @@ class cmMakefile;
20, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0117, \
"MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
20, 0, cmPolicies::WARN)
20, 0, cmPolicies::WARN) \
SELECT( \
POLICY, CMP0118, \
"The GENERATED source file property is now visible in all directories.", \
3, 20, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \