INTERFACE_INCLUDE_DIRECTORIES.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. INTERFACE_INCLUDE_DIRECTORIES
  2. -----------------------------
  3. List of public include directories for a library.
  4. The :command:`target_include_directories` command populates this property
  5. with values given to the ``PUBLIC`` and ``INTERFACE`` keywords. Projects
  6. may also get and set the property directly.
  7. Targets may populate this property to publish the include directories
  8. required to compile against the headers for the target. Consuming
  9. targets can add entries to their own :prop_tgt:`INCLUDE_DIRECTORIES`
  10. property such as ``$<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES>``
  11. to use the include directories specified in the interface of ``foo``.
  12. Contents of ``INTERFACE_INCLUDE_DIRECTORIES`` may use "generator expressions"
  13. with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
  14. manual for available expressions. See the :manual:`cmake-buildsystem(7)`
  15. manual for more on defining buildsystem properties.
  16. Include directories usage requirements commonly differ between the build-tree
  17. and the install-tree. The ``BUILD_INTERFACE`` and ``INSTALL_INTERFACE``
  18. generator expressions can be used to describe separate usage requirements
  19. based on the usage location. Relative paths are allowed within the
  20. ``INSTALL_INTERFACE`` expression and are interpreted relative to the
  21. installation prefix. For example:
  22. .. code-block:: cmake
  23. set_property(TARGET mylib APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
  24. $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib>
  25. $<INSTALL_INTERFACE:include/mylib> # <prefix>/include/mylib
  26. )