Skip to content

Commit

Permalink
Provide example for setting C++ language standard in GoogleTest's Baz…
Browse files Browse the repository at this point in the history
…el quickstart and readme.

An equivalent for CMake was merged in google@aa99ce5

Fixes google#4254

PiperOrigin-RevId: 536759641
Change-Id: I8400064a24e0d78f17a0720046f505efa1167b4f
  • Loading branch information
dinord authored and kunitoki committed Nov 4, 2023
1 parent f19d38b commit 76ba602
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docs/quickstart-bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,17 @@ file (`@com_google_googletest`). For more information about Bazel `BUILD` files,
see the
[Bazel C++ Tutorial](https://docs.bazel.build/versions/main/tutorial/cpp.html).

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

Now you can build and run your test:

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

0 comments on commit 76ba602

Please sign in to comment.