define_property.rst 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. define_property
  2. ---------------
  3. Define and document custom properties.
  4. ::
  5. define_property(<GLOBAL | DIRECTORY | TARGET | SOURCE |
  6. TEST | VARIABLE | CACHED_VARIABLE>
  7. PROPERTY <name> [INHERITED]
  8. BRIEF_DOCS <brief-doc> [docs...]
  9. FULL_DOCS <full-doc> [docs...])
  10. Define one property in a scope for use with the :command:`set_property` and
  11. :command:`get_property` commands. This is primarily useful to associate
  12. documentation with property names that may be retrieved with the
  13. :command:`get_property` command. The first argument determines the kind of
  14. scope in which the property should be used. It must be one of the
  15. following:
  16. ::
  17. GLOBAL = associated with the global namespace
  18. DIRECTORY = associated with one directory
  19. TARGET = associated with one target
  20. SOURCE = associated with one source file
  21. TEST = associated with a test named with add_test
  22. VARIABLE = documents a CMake language variable
  23. CACHED_VARIABLE = documents a CMake cache variable
  24. Note that unlike :command:`set_property` and :command:`get_property` no
  25. actual scope needs to be given; only the kind of scope is important.
  26. The required ``PROPERTY`` option is immediately followed by the name of
  27. the property being defined.
  28. If the ``INHERITED`` option then the :command:`get_property` command will
  29. chain up to the next higher scope when the requested property is not set
  30. in the scope given to the command. ``DIRECTORY`` scope chains to
  31. ``GLOBAL``. ``TARGET``, ``SOURCE``, and ``TEST`` chain to ``DIRECTORY``.
  32. The ``BRIEF_DOCS`` and ``FULL_DOCS`` options are followed by strings to be
  33. associated with the property as its brief and full documentation.
  34. Corresponding options to the :command:`get_property` command will retrieve
  35. the documentation.