For third-party libraries that are brought in via external repositories, includes = ["."] may actually be the desired behavior if they are only exporting a single cc_library target.
For example, see https://bazelbuild.slack.com/archives/CGA9QFQ8H/p1754145239223169 in which I wrote BUILD files for libxslt. The sources in that library import the headers as <libxslt/xslt.h> but also "xslt.h".
I originally had it working with the following target
cc_library(
name = "libxslt",
srcs = [
"config.h",
"libxslt/xsltconfig.h",
] + glob([
"libxslt/*.c",
"libxslt/*.h",
]),
includes = ["."],
deps = [
"@libxml2",
],
visibility = ["//visibility:public"],
)
Due to the ban of includes = ["."] I had to lower the target definition into the //libxslt package, which resulted in issues setting up the proper prefixes for the headers. I ended up resolving it by using copy_file targets for all the sources and headers to arrange them the way they expected to be arranged, but none of this would be necessary if we could specify this target at the repository root.
For third-party libraries that are brought in via external repositories,
includes = ["."]may actually be the desired behavior if they are only exporting a single cc_library target.For example, see https://bazelbuild.slack.com/archives/CGA9QFQ8H/p1754145239223169 in which I wrote BUILD files for
libxslt. The sources in that library import the headers as<libxslt/xslt.h>but also"xslt.h".I originally had it working with the following target
Due to the ban of
includes = ["."]I had to lower the target definition into the//libxsltpackage, which resulted in issues setting up the proper prefixes for the headers. I ended up resolving it by usingcopy_filetargets for all the sources and headers to arrange them the way they expected to be arranged, but none of this would be necessary if we could specify this target at the repository root.