'Bazel: How can I exclude the build warnings from the external included header files
I have a situation where I include the header file of the library which I want to use in my main program. The main program is warning free and it has a feature of treating warnings as errors. Now, when I try to include the external library's header file, the build is failing as that header file is containing the warnings. The issue here is, the external library is dynamic and we can not modify it. So, is there any way by which I can avoid the external warnings popping up in my build and being treated as errors?
I tried isystem
and --features=external_include_paths
by referring to below link:
https://github.com/erenon/bazel/commit/eeea88ef7900bece43222414751d8f17599af51c
But it is not helping me, it is still giving me errors.
EDIT: I am trying to prepare the BUILD file like this:
package(
features = ["warning_as_error", "external_include_paths"],
)
cc_library(
name = "test_build",
src = ["*.cpp"],
copts = ["-Ilib_containing_warning"],
deps = ["@other_lib"],
)
Here, lib_containing_warning is the library containing the warnings which is built along with "test_build" but fails to build as "warning_as_error" is enabled. Also, the header files from lib_containing_warning which contains warnings are also included in the source files as well which creates problem. How can I completely ignore the warnings from the external libs?
Can anyone help me out through this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|