set_property.rst 2.7 KB

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