get_target_property.rst 1018 B

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