get_target_property.rst 1.0 KB

1234567891011121314151617181920212223242526272829
  1. get_target_property
  2. -------------------
  3. Get a property from a target.
  4. .. code-block:: cmake
  5. get_target_property(<variable> <target> <property>)
  6. Get a property from a target. The value of the property is stored in the
  7. specified ``<variable>``. If the target property is not found, ``<variable>``
  8. will be set to ``<variable>-NOTFOUND``. If the target property was defined to
  9. be an ``INHERITED`` property (see :command:`define_property`), the search will
  10. include the relevant parent scopes, as described for the
  11. :command:`define_property` command.
  12. Use :command:`set_target_properties` to set target property values.
  13. Properties are usually used to control how a target is built, but some
  14. query the target instead. This command can get properties for any
  15. target so far created. The targets do not need to be in the current
  16. ``CMakeLists.txt`` file.
  17. See Also
  18. ^^^^^^^^
  19. * :command:`define_property`
  20. * the more general :command:`get_property` command
  21. * :command:`set_target_properties`
  22. * :ref:`Target Properties` for the list of properties known to CMake