1
0

set_property.rst 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. set_property
  2. ------------
  3. Set a named property in a given scope.
  4. .. code-block:: cmake
  5. set_property(<GLOBAL |
  6. DIRECTORY [<dir>] |
  7. TARGET [<target1> ...] |
  8. SOURCE [<src1> ...] |
  9. INSTALL [<file1> ...] |
  10. TEST [<test1> ...] |
  11. CACHE [<entry1> ...] >
  12. [APPEND] [APPEND_STRING]
  13. PROPERTY <name> [value1 ...])
  14. Sets one property on zero or more objects of a scope.
  15. The first argument determines the scope in which the property is set.
  16. It must be one of the following:
  17. ``GLOBAL``
  18. Scope is unique and does not accept a name.
  19. ``DIRECTORY``
  20. Scope defaults to the current directory but another directory
  21. (already processed by CMake) may be named by full or relative path.
  22. See also the :command:`set_directory_properties` command.
  23. ``TARGET``
  24. Scope may name zero or more existing targets.
  25. See also the :command:`set_target_properties` command.
  26. ``SOURCE``
  27. Scope may name zero or more source files. Note that source
  28. file properties are visible only to targets added in the same
  29. directory (``CMakeLists.txt``).
  30. See also the :command:`set_source_files_properties` command.
  31. ``INSTALL``
  32. Scope may name zero or more installed file paths.
  33. These are made available to CPack to influence deployment.
  34. Both the property key and value may use generator expressions.
  35. Specific properties may apply to installed files and/or directories.
  36. Path components have to be separated by forward slashes,
  37. must be normalized and are case sensitive.
  38. To reference the installation prefix itself with a relative path use ``.``.
  39. Currently installed file properties are only defined for
  40. the WIX generator where the given paths are relative
  41. to the installation prefix.
  42. ``TEST``
  43. Scope may name zero or more existing tests.
  44. See also the :command:`set_tests_properties` command.
  45. ``CACHE``
  46. Scope must name zero or more cache existing entries.
  47. The required ``PROPERTY`` option is immediately followed by the name of
  48. the property to set. Remaining arguments are used to compose the
  49. property value in the form of a semicolon-separated list.
  50. If the ``APPEND`` option is given the list is appended to any existing
  51. property value. If the ``APPEND_STRING`` option is given the string is
  52. appended to any existing property value as string, i.e. it results in a
  53. longer string and not a list of strings. When using ``APPEND`` or
  54. ``APPEND_STRING`` with a property defined to support ``INHERITED``
  55. behavior (see :command:`define_property`), no inheriting occurs when
  56. finding the initial value to append to. If the property is not already
  57. directly set in the nominated scope, the command will behave as though
  58. ``APPEND`` or ``APPEND_STRING`` had not been given.
  59. See the :manual:`cmake-properties(7)` manual for a list of properties
  60. in each scope.