[Wconversion] Suppress warnings

Bug: 58162
Change-Id: Iddfc0653b953a93dbb898e4348266ad1888d48a2
diff --git a/BUILD.gn b/BUILD.gn
index 375769d..413e124 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -25,13 +25,12 @@
 #  POSSIBILITY OF SUCH DAMAGE.
 #
 
-source_set("lib-ot-core") {
-  # Suppress warnings in upstream code that are triggered by Fuchsia compilation flags.
-  cflags_cc = [
-    "-Wno-non-virtual-dtor",
-    "-Wno-conversion",
-  ]
+config("no-warnings") {
+  cflags = [ "-Wno-conversion" ]
+  visibility = [ ":*" ]
+}
 
+source_set("lib-ot-core") {
   sources = [
     "src/core/api/backbone_router_api.cpp",
     "src/core/api/backbone_router_ftd_api.cpp",
@@ -244,4 +243,8 @@
     "OPENTHREAD_CONFIG_LOG_PLATFORM=1",
     "OPENTHREAD_CONFIG_LOG_LEVEL=6",
   ]
+
+  # Suppress warnings in upstream code that are triggered by Fuchsia compilation flags.
+  public_configs = [ ":no-warnings" ]
+  cflags_cc = [ "-Wno-non-virtual-dtor" ]
 }