• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1get_target_property
2-------------------
3
4Get a property from a target.
5
6.. code-block:: cmake
7
8  get_target_property(<VAR> target property)
9
10Get a property from a target.  The value of the property is stored in
11the variable ``<VAR>``.  If the target property is not found, the behavior
12depends on whether it has been defined to be an ``INHERITED`` property
13or not (see :command:`define_property`).  Non-inherited properties will
14set ``<VAR>`` to ``<VAR>-NOTFOUND``, whereas inherited properties will search
15the relevant parent scope as described for the :command:`define_property`
16command and if still unable to find the property, ``<VAR>`` will be set to
17an empty string.
18
19Use :command:`set_target_properties` to set target property values.
20Properties are usually used to control how a target is built, but some
21query the target instead.  This command can get properties for any
22target so far created.  The targets do not need to be in the current
23``CMakeLists.txt`` file.
24
25See also the more general :command:`get_property` command.
26
27See :ref:`Target Properties` for the list of properties known to CMake.
28