Skip to content

Feature Request: local_includes for cc_library, making an easy path for good cross-platform hygiene #16472

@cpsauer

Description

@cpsauer

Hi wonderful Bazelers,

This is a small-scope cc feature request.

As background: cc_library lets you specify include directories for its headers, automatically handling the package. This is very nice for interface headers but bad problematic for implementation headers you don't want to propagate to dependents. The docs steer you to add -I flags to copts to handle that case.

The problem is that this leads people to write code that won't work with toolchains where the flags are different. And needing to figure out that you have to use package_name() (which doesn't handle the external workspace case) tends to lead users to just make all includes public, propagating them to all dependencies. Bad times.

A fairly simple new parameter, local_includes could solve this well, I'd propose. What do you think?

Thanks,
Chris
(ex-Googler)
P.S. Edited from the template for clarity, brevity, and friendliness.

Metadata

Metadata

Labels

P2We'll consider working on this in future. (Assignee optional)team-Rules-CPPIssues for C++ rulestype: feature request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions