diff --git a/third_party/gflags/BUILD.gn b/third_party/gflags/BUILD.gn index 2b8d9c8d2..913c55875 100644 --- a/third_party/gflags/BUILD.gn +++ b/third_party/gflags/BUILD.gn @@ -16,7 +16,7 @@ if (is_win) { } config("gflags_config") { - include_dirs = [ + include_dirs = [ "$gflags_gen_arch_root/include", # For configured files. "src", # For everything else. ] @@ -28,6 +28,13 @@ config("gflags_config") { "GFLAGS_DLL_DECLARE_FLAG=", "GFLAGS_DLL_DEFINE_FLAG=", ] + + # GN orders flags on a target before flags from configs. The default config + # adds -Wall, and this flag have to be after -Wall -- so they need to + # come from a config and can't be on the target directly. + if (is_clang) { + cflags = [ "-Wno-unused-local-typedef" ] + } } source_set("gflags") { @@ -45,9 +52,7 @@ source_set("gflags") { ] } - include_dirs = [ - "$gflags_gen_arch_root/include/private", # For config.h - ] + include_dirs = [ "$gflags_gen_arch_root/include/private" ] # For config.h public_configs = [ ":gflags_config" ] @@ -60,3 +65,4 @@ source_set("gflags") { configs -= [ "//build/config/clang:extra_warnings" ] } } + diff --git a/third_party/gflags/gflags.gyp b/third_party/gflags/gflags.gyp index 57567fa3b..7ce3f80f6 100644 --- a/third_party/gflags/gflags.gyp +++ b/third_party/gflags/gflags.gyp @@ -76,8 +76,10 @@ }, }], ['clang==1', { + 'cflags': ['-Wno-unused-local-typedef',], 'cflags!': ['-Wheader-hygiene',], 'xcode_settings': { + 'WARNING_CFLAGS': ['-Wno-unused-local-typedef',], 'WARNING_CFLAGS!': ['-Wheader-hygiene',], }, }], @@ -85,3 +87,4 @@ }, ], } +