From 0cd2e3926e95e7e2930f57ae3f4885508d462a25 Mon Sep 17 00:00:00 2001 From: Dmitry Rozhkov Date: Tue, 8 Sep 2020 17:48:31 +0300 Subject: [PATCH] Fix MSVC linker error (#840) The -lm linker option is not known to MSVC and setting it triggers errors in some build systems: [6,366 / 6,367] Linking source/exe/envoy-static.exe; 11s remote LINK : warning LNK4044: unrecognized option '/lm'; ignored LINK : error LNK1218: warning treated as error; no output file generated ERROR: C:/source/source/exe/BUILD:22:16: Linking of rule '//source/exe:envoy-static' failed (Exit 4044): link.exe failed: error executing command Do not set -lm in case of MSVC. --- BUILD | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 4c9b57a..f53ec8f 100644 --- a/BUILD +++ b/BUILD @@ -123,7 +123,10 @@ cc_library( srcs = [":enc_sources"], hdrs = [":enc_headers"], copts = STRICT_C_OPTIONS, - linkopts = ["-lm"], + linkopts = select({ + ":msvc": [], + "//conditions:default": ["-lm"], + }), deps = [":brotlicommon"], )