Skip to content

declare_dependency() sources inconsistently added to include paths #14421

Open
@pobrn

Description

@pobrn

Consider

# directory 'a'
some_generated_file = custom_target(
        'some_generated_file.h',
        output: 'some_generated_file.h',
        ...
)

# top-level
x = declare_dependency(
        sources: [
                some_generated_file,
                'b/some_static_file.h',
        ],
)

If another target depends on x, then -Ia (location of some_generated_file.h) will be added implicitly. However, -Ib, parent directory of some_static_file.h, listed in sources as well, will not be added.

Furthermore, setting implicit_include_directories: false will cause -Ia to not be added.

What is the reason for this inconsistency? Is there a way to specify a generated header file in declare_dependency() in such a way that its parent directory won't be added implicitly? (In my case the file is already generated into a directory added explicitly using include_diretories, and I don't want to be able to do #include "some_generated_file.h", only #include <some/path/some_generated_file.h should work. Or is there an issue with this?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions