Merge 9dca75edc0151345e6031960d95375014be8f5fa into 7140cd416cecd7462a8aae488024abeee55598e4

This commit is contained in:
Ürem Sancaktutan 2026-06-02 21:56:23 -04:00 committed by GitHub
commit 507e787220
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 2 deletions

View File

@ -77,6 +77,12 @@ config_setting(
values = {"define": "absl=1"},
)
config_setting(
name = "bzlmod_enabled",
flag_values = {"//command_line_option:enable_bzlmod": "true"},
)
# Library that defines the FRIEND_TEST macro.
cc_library(
name = "gtest_prod",
@ -115,8 +121,9 @@ cc_library(
":windows": [],
"//conditions:default": ["-pthread"],
}),
defines = select({
defines = select({
":has_absl": ["GTEST_HAS_ABSL=1"],
":bzlmod_enabled": ["GTEST_HAS_ABSL=1"],
"//conditions:default": [],
}),
features = select({
@ -142,7 +149,7 @@ cc_library(
],
"//conditions:default": ["-pthread"],
}),
deps = select({
deps = select({
":has_absl": [
"@abseil-cpp//absl/container:flat_hash_set",
"@abseil-cpp//absl/debugging:failure_signal_handler",
@ -155,6 +162,18 @@ cc_library(
"@abseil-cpp//absl/strings",
"@re2",
],
":bzlmod_enabled": [
"@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": [],
}) + select({
# `gtest-death-test.cc` has `EXPECT_DEATH` that spawns a process,

10
TODO.md Normal file
View File

@ -0,0 +1,10 @@
# TODO: Fix has_absl default to true for bzlmod
## Remaining Steps:
1. [x] Edit BUILD.bazel: Add bzlmod_enabled config_setting and update gtest defines/deps selects.
2. [x] Edit docs/quickstart-bazel.md: Add note about default Abseil support with bzlmod.
3. [x] Test changes: bazel test //... --enable_bzlmod=true succeeded.
4. attempt_completion.
Progress will be updated as steps complete.

View File

@ -51,6 +51,8 @@ with the following content:
bazel_dep(name = "googletest", version = "1.17.0")
```
**Note:** When using bzlmod/BCR, Abseil support (including AbslStringify for custom printers) is enabled by default since Abseil is an unconditional dependency.
Now you're ready to build C++ code that uses GoogleTest.
## Create and run a binary