get_property.rst 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. get_property
  2. ------------
  3. Get a property.
  4. ::
  5. get_property(<variable>
  6. <GLOBAL |
  7. DIRECTORY [dir] |
  8. TARGET <target> |
  9. SOURCE <source> |
  10. INSTALL <file> |
  11. TEST <test> |
  12. CACHE <entry> |
  13. VARIABLE>
  14. PROPERTY <name>
  15. [SET | DEFINED | BRIEF_DOCS | FULL_DOCS])
  16. Get one property from one object in a scope. The first argument
  17. specifies the variable in which to store the result. The second
  18. argument determines the scope from which to get the property. It must
  19. be one of the following:
  20. ``GLOBAL``
  21. Scope is unique and does not accept a name.
  22. ``DIRECTORY``
  23. Scope defaults to the current directory but another
  24. directory (already processed by CMake) may be named by full or
  25. relative path.
  26. ``TARGET``
  27. Scope must name one existing target.
  28. ``SOURCE``
  29. Scope must name one source file.
  30. ``INSTALL``
  31. Scope must name one installed file path.
  32. ``TEST``
  33. Scope must name one existing test.
  34. ``CACHE``
  35. Scope must name one cache entry.
  36. ``VARIABLE``
  37. Scope is unique and does not accept a name.
  38. The required ``PROPERTY`` option is immediately followed by the name of
  39. the property to get. If the property is not set an empty value is
  40. returned. If the ``SET`` option is given the variable is set to a boolean
  41. value indicating whether the property has been set. If the ``DEFINED``
  42. option is given the variable is set to a boolean value indicating
  43. whether the property has been defined such as with the
  44. :command:`define_property` command.
  45. If ``BRIEF_DOCS`` or ``FULL_DOCS`` is given then the variable is set to a
  46. string containing documentation for the requested property. If
  47. documentation is requested for a property that has not been defined
  48. ``NOTFOUND`` is returned.