target_include_directories.rst 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. target_include_directories
  2. --------------------------
  3. Add include directories to a target.
  4. ::
  5. target_include_directories(<target> [SYSTEM] [BEFORE] <INTERFACE|PUBLIC|PRIVATE> [items1...]
  6. [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
  7. Specify include directories or targets to use when compiling a given
  8. target. The named <target> must have been created by a command such
  9. as add_executable or add_library and must not be an IMPORTED target.
  10. If BEFORE is specified, the content will be prepended to the property
  11. instead of being appended.
  12. The INTERFACE, PUBLIC and PRIVATE keywords are required to specify the
  13. scope of the following arguments. PRIVATE and PUBLIC items will
  14. populate the INCLUDE_DIRECTORIES property of <target>. PUBLIC and
  15. INTERFACE items will populate the INTERFACE_INCLUDE_DIRECTORIES
  16. property of <target>. The following arguments specify include
  17. directories. Specified include directories may be absolute paths or
  18. relative paths. Repeated calls for the same <target> append items in
  19. the order called.If SYSTEM is specified, the compiler will be told the
  20. directories are meant as system include directories on some platforms
  21. (signalling this setting might achieve effects such as the compiler
  22. skipping warnings, or these fixed-install system files not being
  23. considered in dependency calculations - see compiler docs). If SYSTEM
  24. is used together with PUBLIC or INTERFACE, the
  25. INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property will be populated
  26. with the specified directories.
  27. Arguments to target_include_directories may use "generator
  28. expressions" with the syntax "$<...>".
  29. See the :manual:`cmake-generator-expressions(7)` manual for available
  30. expressions.