Consider winsdk_samples a system library (attempt 3).
Using -imsvc will not trigger warnings when winsdk_samples headers are
included in WebRTC (it is similar to -isystem on GCC and clang).
Bug: webrtc:9251
Change-Id: Iae9b81ae90a3141c72b829cf27f01b9a60047dab
TBR=phoglund@webrtc.org
Reviewed-on: https://webrtc-review.googlesource.com/76720
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
diff --git a/BUILD.gn b/BUILD.gn
index 291a208..52da987 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -10,9 +10,20 @@
baseclasses_dir = "Samples/multimedia/directshow/baseclasses"
config("winsdk_samples_config") {
- include_dirs = [ baseclasses_dir ]
+ if (is_win && is_clang) {
+ # When compiling with clang-cl, use -imsvc (similar to -isystem in clang)
+ # instead of include_dirs (-I), so we don't need to suppress warnings
+ # coming from this package in other projects.
+ "-imsvc",
+ rebase_path(baseclasses_dir, root_build_dir),
+ } else {
+ include_dirs = [ baseclasses_dir ]
+ }
}
+ # These warnings suppression flags are still needed even if -imsvc is used
+ # because some of them will trigger when .cpp files in this package are
+ # compiled.
config("winsdk_samples_warnings_config") {
if (is_win && is_clang) {
cflags = [