get_property.rst 1.7 KB

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