Skip to content

[Bug #4953] Enable GTEST_HAS_ABSL by default when using bzlmod#4954

Open
codelovingcat wants to merge 2 commits into
google:mainfrom
codelovingcat:bug-4953-has-absl-bzlmod-default-true
Open

[Bug #4953] Enable GTEST_HAS_ABSL by default when using bzlmod#4954
codelovingcat wants to merge 2 commits into
google:mainfrom
codelovingcat:bug-4953-has-absl-bzlmod-default-true

Conversation

@codelovingcat
Copy link
Copy Markdown

Summary

Enable GTEST_HAS_ABSL by default when using bzlmod/BCR.

Problem

When using bzlmod, abseil-cpp is an unconditional dependency, but GTEST_HAS_ABSL defaults to off.
This causes features like AbslStringify to fail, print incorrect values, or cause compilation errors.

Solution

  • Added a new config_setting named bzlmod_enabled triggered by --enable_bzlmod=true.
  • Updated //:gtest defines and deps select() statements to enable GTEST_HAS_ABSL=1 and link Abseil if either:
    • --define absl=1 (:has_absl)
    • bzlmod is enabled (:bzlmod_enabled)
  • Updated docs/quickstart-bazel.md to note that Abseil support is enabled by default with bzlmod/BCR.

Backward Compatibility

  • WORKSPACE users still need --define absl=1 to enable Abseil support.
  • Behavior for existing workflows remains unchanged.

Testing

bazel test //... --enable_bzlmod=true

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 7, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant