Skip to content
  • Stephen Kelly's avatar
    Use the link information as a source of compile definitions and includes. · a1c4905f
    Stephen Kelly authored
    After evaluating the INTERFACE_INCLUDE_DIRECTORIES, of a target in a
    generator expression, also read the INTERFACE_INCLUDE_DIRECTORIES of
    its link interface dependencies.
    
    That means that code such as this will result in the 'user' target
    using /bar/include and /foo/include:
    
     add_library(foo ...)
     target_include_directories(foo INTERFACE /foo/include)
     add_library(bar ...)
     target_include_directories(bar INTERFACE /bar/include)
     target_link_libraries(bar LINK_PUBLIC foo)
    
     add_executable(user ...)
     target_include_directories(user PRIVATE
        $<TARGET_PROPERTY:bar,INTERFACE_INCLUDE_DIRECTORIES>)
    
    Also process the interface include directories from direct link
    dependencies for in-build targets.
    
    The situation is similar for the INTERFACE_COMPILE_DEFINITIONS. The
    include directories related code is currently more complex because
    we also need to store a backtrace at configure-time for the purpose
    of debugging includes. The compile definitions related code will use
    the same pattern in the future.
    
    This is not a change in behavior, as existing code has the same effect,
    but that existing code will be removed in follow-up commits.
    a1c4905f