mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Fix linker errors on (Free|Open)BSD. (#6860)
* Fix linker errors on (Free|Open)BSD. * Adds a TODO for the FreeBSD linker flags: -lm and moves platform config to main BUILD.bazel
This commit is contained in:
committed by
GitHub
parent
f63c130c28
commit
2dd2126379
14
BUILD.bazel
14
BUILD.bazel
@@ -10,6 +10,20 @@ exports_files([
|
||||
"LICENSE",
|
||||
])
|
||||
|
||||
config_setting(
|
||||
name = "platform_freebsd",
|
||||
constraint_values = [
|
||||
"@platforms//os:freebsd",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "platform_openbsd",
|
||||
constraint_values = [
|
||||
"@platforms//os:openbsd",
|
||||
],
|
||||
)
|
||||
|
||||
# Public flatc library to compile flatbuffer files at runtime.
|
||||
cc_library(
|
||||
name = "flatbuffers",
|
||||
|
||||
@@ -17,6 +17,15 @@ cc_library(
|
||||
"util.cpp",
|
||||
],
|
||||
hdrs = ["//:public_headers"],
|
||||
linkopts = select({
|
||||
# TODO: Bazel uses `clang` instead of `clang++` to link
|
||||
# C++ code on BSD. Temporarily adding these linker flags while
|
||||
# we wait for Bazel to resolve
|
||||
# https://github.com/bazelbuild/bazel/issues/12023.
|
||||
"//:platform_freebsd": ["-lm"],
|
||||
"//:platform_openbsd": ["-lm"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
strip_include_prefix = "/include",
|
||||
visibility = ["//:__pkg__"],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user