mirror of
https://github.com/google/googletest.git
synced 2026-06-15 08:26:11 +08:00
Default GTEST_HAS_ABSL=1 since abseil is an unconditional dep
abseil-cpp is loaded unconditionally under bzlmod (via bazel_dep) and under WORKSPACE (via googletest_deps()), but GTEST_HAS_ABSL was only defined when the user passed --define absl=1. As a result, features gated on the macro (AbslStringify support, absl::flags parsing, the failure-signal handler) silently stayed off even though the abseil dependency was being pulled in. Flip the default: enable absl integration by default and let users opt out with --define absl=0. Existing scripts passing --define absl=1 keep working as a no-op. Also extract the absl deps list into a local variable to avoid duplication. Fixes #4953
This commit is contained in:
parent
d72f9c8aea
commit
dd60eb1d08
36
BUILD.bazel
36
BUILD.bazel
@ -73,10 +73,23 @@ config_setting(
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "has_absl",
|
||||
values = {"define": "absl=1"},
|
||||
name = "absl_disabled",
|
||||
values = {"define": "absl=0"},
|
||||
)
|
||||
|
||||
_ABSL_DEPS = [
|
||||
"@abseil-cpp//absl/container:flat_hash_set",
|
||||
"@abseil-cpp//absl/debugging:failure_signal_handler",
|
||||
"@abseil-cpp//absl/debugging:stacktrace",
|
||||
"@abseil-cpp//absl/debugging:symbolize",
|
||||
"@abseil-cpp//absl/flags:flag",
|
||||
"@abseil-cpp//absl/flags:parse",
|
||||
"@abseil-cpp//absl/flags:reflection",
|
||||
"@abseil-cpp//absl/flags:usage",
|
||||
"@abseil-cpp//absl/strings",
|
||||
"@re2",
|
||||
]
|
||||
|
||||
# Library that defines the FRIEND_TEST macro.
|
||||
cc_library(
|
||||
name = "gtest_prod",
|
||||
@ -116,8 +129,8 @@ cc_library(
|
||||
"//conditions:default": ["-pthread"],
|
||||
}),
|
||||
defines = select({
|
||||
":has_absl": ["GTEST_HAS_ABSL=1"],
|
||||
"//conditions:default": [],
|
||||
":absl_disabled": [],
|
||||
"//conditions:default": ["GTEST_HAS_ABSL=1"],
|
||||
}),
|
||||
features = select({
|
||||
":windows": ["windows_export_all_symbols"],
|
||||
@ -143,19 +156,8 @@ cc_library(
|
||||
"//conditions:default": ["-pthread"],
|
||||
}),
|
||||
deps = select({
|
||||
":has_absl": [
|
||||
"@abseil-cpp//absl/container:flat_hash_set",
|
||||
"@abseil-cpp//absl/debugging:failure_signal_handler",
|
||||
"@abseil-cpp//absl/debugging:stacktrace",
|
||||
"@abseil-cpp//absl/debugging:symbolize",
|
||||
"@abseil-cpp//absl/flags:flag",
|
||||
"@abseil-cpp//absl/flags:parse",
|
||||
"@abseil-cpp//absl/flags:reflection",
|
||||
"@abseil-cpp//absl/flags:usage",
|
||||
"@abseil-cpp//absl/strings",
|
||||
"@re2",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
":absl_disabled": [],
|
||||
"//conditions:default": _ABSL_DEPS,
|
||||
}) + select({
|
||||
# `gtest-death-test.cc` has `EXPECT_DEATH` that spawns a process,
|
||||
# expects it to crash and inspects its logs with the given matcher,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user