bazelbuild / rules_cc

C++ Rules for Bazel
https://bazel.build
Apache License 2.0
176 stars 88 forks source link

how to judge repository is an external repo or not in BUILD file? #216

Closed xiedeacc closed 7 months ago

xiedeacc commented 7 months ago

I'm writing a BUILD file for libdwarf, a genrule used to generate a config.h, and this config.h was included by a source file use

#include <config.h>

this means, directory that contains config.h must be add to search path by -isystem, but bazel just add directory contains config.h use -iquote, so compile will fail for cannot find config.h. so I need pass

"-isystem $(GENDIR)/src"

to copts, this works well in libdwarf repository, but if libdwarf is an external repository in other repository, this will compile failed for $(GENDIR)/src not diretory contains config.h any more

here is a demo https://github.com/xiedeacc/libdwarf.git

bazel 6.2.1

comius commented 7 months ago

Duplicate of https://github.com/bazelbuild/bazel/issues/20586