Help: Fix wrong return values for unset inherited properties

Since ff6234509e (Help: Clarify behavior of INHERITED properties, 2018-03-21),
the docs for some get_..._property() commands incorrectly describe
the behavior for inherited properties. When a property is not set, even
in a parent scope, the returned result from the get_..._property()
command is the same whether the property is inherited or not.
The docs incorrectly stated that an empty string would be returned
for inherited properties in such cases.
This commit is contained in:
Craig Scott
2024-01-05 17:33:07 +11:00
parent 1ca5ec67b0
commit 8086badba4
3 changed files with 16 additions and 22 deletions
+6 -8
View File
@@ -9,14 +9,12 @@ Get a property for a source file.
[DIRECTORY <dir> | TARGET_DIRECTORY <target>] [DIRECTORY <dir> | TARGET_DIRECTORY <target>]
<property>) <property>)
Gets a property from a source file. The value of the property is Gets a property from a source file. The value of the property is stored in
stored in the specified ``<variable>``. If the source property is not found, the specified ``<variable>``. If the ``<file>`` is not a source file, or the
the behavior depends on whether it has been defined to be an ``INHERITED`` source property is not found, ``<variable>`` will be set to ``NOTFOUND``.
property or not (see :command:`define_property`). Non-inherited properties If the source property was defined to be an ``INHERITED`` property (see
will set ``variable`` to ``NOTFOUND``, whereas inherited properties will search :command:`define_property`), the search will include the relevant parent
the relevant parent scope as described for the :command:`define_property` scopes, as described for the :command:`define_property` command.
command and if still unable to find the property, ``variable`` will be set to
an empty string.
By default, the source file's property will be read from the current source By default, the source file's property will be read from the current source
directory's scope. directory's scope.
+5 -7
View File
@@ -8,13 +8,11 @@ Get a property from a target.
get_target_property(<variable> <target> <property>) get_target_property(<variable> <target> <property>)
Get a property from a target. The value of the property is stored in the Get a property from a target. The value of the property is stored in the
specified ``<variable>``. If the target property is not found, the behavior specified ``<variable>``. If the target property is not found, ``<variable>``
depends on whether it has been defined to be an ``INHERITED`` property will be set to ``<variable>-NOTFOUND``. If the target property was defined to
or not (see :command:`define_property`). Non-inherited properties will set be an ``INHERITED`` property (see :command:`define_property`), the search will
``<variable>`` to ``<variable>-NOTFOUND``, whereas inherited properties will include the relevant parent scopes, as described for the
search the relevant parent scope as described for the :command:`define_property` :command:`define_property` command.
command and if still unable to find the property, ``<variable>`` will be set to
an empty string.
Use :command:`set_target_properties` to set target property values. Use :command:`set_target_properties` to set target property values.
Properties are usually used to control how a target is built, but some Properties are usually used to control how a target is built, but some
+5 -7
View File
@@ -8,13 +8,11 @@ Get a property of the test.
get_test_property(<test> <property> [DIRECTORY <dir>] <variable>) get_test_property(<test> <property> [DIRECTORY <dir>] <variable>)
Get a property from the test. The value of the property is stored in Get a property from the test. The value of the property is stored in
the specified ``<variable>``. If the test property is not found, the behavior the specified ``<variable>``. If the ``<test>`` is not defined, or the
depends on whether it has been defined to be an ``INHERITED`` property test property is not found, ``<variable>`` will be set to ``NOTFOUND``.
or not (see :command:`define_property`). Non-inherited properties will set If the test property was defined to be an ``INHERITED`` property (see
``<variable>`` to ``NOTFOUND``, whereas inherited properties will search the :command:`define_property`), the search will include the relevant parent
relevant parent scope as described for the :command:`define_property` scopes, as described for the :command:`define_property` command.
command and if still unable to find the property, ``<variable>`` will be set to
an empty string.
For a list of standard properties you can type For a list of standard properties you can type
:option:`cmake --help-property-list`. :option:`cmake --help-property-list`.