target_compile_definitions.rst 1020 B

123456789101112131415161718192021222324
  1. target_compile_definitions
  2. --------------------------
  3. Add compile definitions to a target.
  4. ::
  5. target_compile_definitions(<target> <INTERFACE|PUBLIC|PRIVATE> [items1...]
  6. [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
  7. Specify compile definitions to use when compiling a given target. The
  8. named <target> must have been created by a command such as
  9. add_executable or add_library and must not be an IMPORTED target. The
  10. INTERFACE, PUBLIC and PRIVATE keywords are required to specify the
  11. scope of the following arguments. PRIVATE and PUBLIC items will
  12. populate the COMPILE_DEFINITIONS property of <target>. PUBLIC and
  13. INTERFACE items will populate the INTERFACE_COMPILE_DEFINITIONS
  14. property of <target>. The following arguments specify compile
  15. definitions. Repeated calls for the same <target> append items in the
  16. order called.
  17. Arguments to target_compile_definitions may use "generator expressions" with
  18. the syntax "$<...>". See the :manual:`cmake-generator-expressions(7)` manual
  19. for available expressions.