Skip to content

Commit 04cf298

Browse files
dinordcopybara-github
authored andcommitted
Provide example for setting C++ language standard in GoogleTest's Bazel quickstart and readme.
An equivalent for CMake was merged in aa99ce5 Fixes #4254 PiperOrigin-RevId: 536759641 Change-Id: I8400064a24e0d78f17a0720046f505efa1167b4f
1 parent a7833a1 commit 04cf298

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/quickstart-bazel.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,17 @@ file (`@com_google_googletest`). For more information about Bazel `BUILD` files,
105105
see the
106106
[Bazel C++ Tutorial](https://docs.bazel.build/versions/main/tutorial/cpp.html).
107107

108+
{: .callout .note}
109+
NOTE: In the example below, we assume Clang or GCC and set `--cxxopt=-std=c++14`
110+
to ensure that GoogleTest is compiled as C++14 instead of the compiler's default
111+
setting (which could be C++11). For MSVC, the equivalent would be
112+
`--cxxopt=/std:c++14`. See [Supported Platforms](platforms.md) for more details
113+
on supported language versions.
114+
108115
Now you can build and run your test:
109116

110117
<pre>
111-
<strong>my_workspace$ bazel test --test_output=all //:hello_test</strong>
118+
<strong>my_workspace$ bazel test --cxxopt=-std=c++14 --test_output=all //:hello_test</strong>
112119
INFO: Analyzed target //:hello_test (26 packages loaded, 362 targets configured).
113120
INFO: Found 1 test target...
114121
INFO: From Testing //:hello_test:

0 commit comments

Comments
 (0)