Make specification of 'cc_library' header dependencies platform-independent. #2172
Labels
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
team-Rules-CPP
Issues for C++ rules
type: feature request
( This was initially being discussed as a random follow-up to #1944 )
Problem / Feature request
Currently the way to specify header dependencies (i.e includes) for a
cc_library
target can be done in the following (non-exhaustive but most easy and frequently used) methods:cc_library
target: use theincludes
field to specify the path to the directories to be included.cc_library
target: use thecopts
field to add a manual include flag to the compiler options.Method 1 is platform agnostic as you only need to specify the path to the directories to the root of the headers to include and paths are already handled in a platform-independent manner.
Method 2 however does not work well for multi-platform projects as GCC and MSVC require different flags (
-I
vs.\I
). A new method should be provided beyondcopts
to include whole directories and not only single files as private headers for acc_library
target.For the moment a work-around exists by using
select
insidecopts
and switching on the platform but this induces a lot of code duplication.Scope, use-cases & discussion
In general, private headers are member of the project and should as such be easy to obtain via a
glob
and specified to thecc_library
throughhdrs
. However this does not cover all "normal" use-cases. An example of a non-supported case:The text was updated successfully, but these errors were encountered: