My project is transitioning to Bazel from CMake and I am including a snapshot of Abseil by checking it into a third_party/
top-level directory within our repository. I need to support both build systems during the transition, so I created CMakeLists.txt
files and noticed that quite a lot of warnings need to be disabled for the Abseil headers to compile.
For CMake, this okay because I can include the headers where I use them by using the #include <absl/strings/str_cat.h>
syntax. This tells my compiler that it's a system header and to ignore the warnings so I don't have to disable them globally.
For Bazel, though, I get this error:
error: 'absl/strings/str_cat.h' file not found with include; use "quotes" instead
Is there a way to tell Bazel to allow the <>
-style includes? Is there another way to disable warnings just for these headers without also disabling them for the whole project?
By default Bazel doesn't emit any cc-library-specific include (
-I
) directory flags for compile actions. Since include lookup is not free we rely on a single rooted header hierarchy. But you can tell Bazel to add custom include directories by usingincludes
on a givencc_library
. Or, preferably, usestrip_include_prefix
andinclude_prefix
.