Kaynağa Gözat

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.
Deniz Bahadir 5 yıl önce
ebeveyn
işleme
0eb30f175e

+ 5 - 0
Help/command/get_property.rst

@@ -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
 string containing documentation for the requested property.  If
 documentation is requested for a property that has not been defined
 documentation is requested for a property that has not been defined
 ``NOTFOUND`` is returned.
 ``NOTFOUND`` is returned.
+
+.. note::
+
+  The :prop_sf:`GENERATED` source file property may be globally visible.
+  See its documentation for details.

+ 5 - 0
Help/command/get_source_file_property.rst

@@ -40,3 +40,8 @@ file properties usually control how the file is built. One property that is
 always there is :prop_sf:`LOCATION`.
 always there is :prop_sf:`LOCATION`.
 
 
 See also the more general :command:`get_property` command.
 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.

+ 5 - 0
Help/command/set_property.rst

@@ -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
 See the :manual:`cmake-properties(7)` manual for a list of properties
 in each scope.
 in each scope.
+
+.. note::
+
+  The :prop_sf:`GENERATED` source file property may be globally visible.
+  See its documentation for details.

+ 5 - 0
Help/command/set_source_files_properties.rst

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

+ 1 - 0
Help/manual/cmake-policies.7.rst

@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.20
 .. toctree::
 .. toctree::
    :maxdepth: 1
    :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>
    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>
    CMP0116: Ninja generators transform DEPFILEs from add_custom_command(). </policy/CMP0116>
    CMP0115: Source file extensions must be explicit. </policy/CMP0115>
    CMP0115: Source file extensions must be explicit. </policy/CMP0115>

+ 17 - 0
Help/policy/CMP0118.rst

@@ -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.

+ 11 - 0
Help/prop_sf/GENERATED.rst

@@ -3,6 +3,9 @@ GENERATED
 
 
 Is this source file generated as part of the build or CMake process.
 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
 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.
 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
 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
 :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
 properties may influence where the generated sources are grouped in the project's
 file lists.
 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.

+ 7 - 0
Help/release/dev/make-GENERATED-visible-from-any-scope.rst

@@ -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`.

+ 5 - 1
Source/cmPolicies.h

@@ -348,7 +348,11 @@ class cmMakefile;
          20, 0, cmPolicies::WARN)                                             \
          20, 0, cmPolicies::WARN)                                             \
   SELECT(POLICY, CMP0117,                                                     \
   SELECT(POLICY, CMP0117,                                                     \
          "MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
          "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_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
 #define CM_FOR_EACH_POLICY_ID(POLICY)                                         \
 #define CM_FOR_EACH_POLICY_ID(POLICY)                                         \