diff --git a/third_party/flatbuffers/BUILD.bazel b/third_party/flatbuffers/BUILD.bazel index 06f0cd210bda74..b3991ea1462be1 100644 --- a/third_party/flatbuffers/BUILD.bazel +++ b/third_party/flatbuffers/BUILD.bazel @@ -8,6 +8,17 @@ exports_files(["LICENSE.txt"]) licenses(["notice"]) +config_setting( + name = "freebsd", + values = {"cpu": "freebsd"}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "windows", + values = {"cpu": "x64_windows"}, +) + load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") # Public flatc library to compile flatbuffer files at runtime. @@ -50,6 +61,16 @@ cc_library( # Public flatc compiler. cc_binary( name = "flatc", + linkopts = select({ + ":freebsd": [ + "-lm", + ], + ":windows": [], + "//conditions:default": [ + "-lm", + "-ldl", + ], + }), deps = [ "@flatbuffers//src:flatc", ],