include_directories.rst 1.2 KB

123456789101112131415161718192021222324252627282930
  1. include_directories
  2. -------------------
  3. Add include directories to the build.
  4. ::
  5. include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)
  6. Add the given directories to those the compiler uses to search for
  7. include files. Relative paths are interpreted as relative to the
  8. current source directory.
  9. The include directories are added to the directory property
  10. INCLUDE_DIRECTORIES for the current CMakeLists file. They are also
  11. added to the target property INCLUDE_DIRECTORIES for each target in
  12. the current CMakeLists file. The target property values are the ones
  13. used by the generators.
  14. By default the directories are appended onto the current list of
  15. directories. This default behavior can be changed by setting
  16. :variable:`CMAKE_INCLUDE_DIRECTORIES_BEFORE` to ON. By using AFTER or BEFORE
  17. explicitly, you can select between appending and prepending,
  18. independent of the default.
  19. If the SYSTEM option is given, 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).