cleanup: reduce warnings on MSVC builds

Protobuf sets the `/utf-8` flag in the linker, but this is a compiler flag [^1]. The linker emits a warning, polluting the logs for all downstream projects [^2] with many `LINK : warning LNK4044: unrecognized option '/utf-8'; ignored` lines.

[^1]: https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170
[^2]: For an example, see [this build](https://github.com/googleapis/google-cloud-cpp/actions/runs/7484447749/job/20371331322#step:5:4146)

PiperOrigin-RevId: 597570083
pull/15397/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 648c20d602
commit c988f9c0c7
  1. 2
      build_defs/cpp_opts.bzl

@ -15,6 +15,7 @@ COPTS = select({
"/wd4506", # no definition for inline function 'function'
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
"/wd4996", # The compiler encountered a deprecated declaration.
"/utf-8", # Set source and execution character sets to UTF-8
],
"//conditions:default": [
"-DHAVE_ZLIB",
@ -35,7 +36,6 @@ LINK_OPTS = select({
"//build_defs:config_msvc": [
# Suppress linker warnings about files with no symbols defined.
"-ignore:4221",
"/utf-8",
],
"@platforms//os:macos": [
"-lpthread",

Loading…
Cancel
Save