diff options
author | Dino Radakovic <dinor@google.com> | 2023-05-31 17:45:02 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-05-31 17:45:43 (GMT) |
commit | 04cf2989168a3f9218d463bea6f15f8ade2032fd (patch) | |
tree | 6a02f76c3b835d726dbcac503cd07fe3e1218183 | |
parent | a7833a19bda5e3c7e0dc226875752514cf77645b (diff) | |
download | googletest-04cf2989168a3f9218d463bea6f15f8ade2032fd.zip googletest-04cf2989168a3f9218d463bea6f15f8ade2032fd.tar.gz googletest-04cf2989168a3f9218d463bea6f15f8ade2032fd.tar.bz2 |
Provide example for setting C++ language standard in GoogleTest's Bazel quickstart and readme.
An equivalent for CMake was merged in https://github.com/google/googletest/commit/aa99ce5a0db4215bb8e2cda3ee68b6b8d4896815
Fixes #4254
PiperOrigin-RevId: 536759641
Change-Id: I8400064a24e0d78f17a0720046f505efa1167b4f
-rw-r--r-- | docs/quickstart-bazel.md | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/docs/quickstart-bazel.md b/docs/quickstart-bazel.md index 15c27a2..4f693db 100644 --- a/docs/quickstart-bazel.md +++ b/docs/quickstart-bazel.md @@ -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: |