Merge pull request #3008 from hyukmyeong:update_tutorial

PiperOrigin-RevId: 340286884
This commit is contained in:
Andy Getz 2020-11-02 22:26:39 -05:00
commit fb98f7447e
3 changed files with 80 additions and 62 deletions

View File

@ -51,7 +51,7 @@ More detailed documentation for googletest is in its interior
## Platforms
Google test has been used on a variety of platforms:
GoogleTest has been used on a variety of platforms:
* Linux
* Mac OS X
@ -94,11 +94,11 @@ result output. If your test runner understands TAP, you may find it useful.
runs tests from your binary in parallel to provide significant speed-up.
[GoogleTest Adapter](https://marketplace.visualstudio.com/items?itemName=DavidSchuldenfrei.gtest-adapter)
is a VS Code extension allowing to view Google Tests in a tree view, and
run/debug your tests.
is a VS Code extension allowing to view GoogleTest in a tree view, and run/debug
your tests.
[C++ TestMate](https://github.com/matepek/vscode-catch2-test-adapter) is a VS
Code extension allowing to view Google Tests in a tree view, and run/debug your
Code extension allowing to view GoogleTest in a tree view, and run/debug your
tests.
[Cornichon](https://pypi.org/project/cornichon/) is a small Gherkin DSL parser
@ -106,9 +106,9 @@ that generates stub code for Google Test.
## Requirements
Google Test is designed to have fairly minimal requirements to build and use
with your projects, but there are some. If you notice any problems on your
platform, please file an issue on the
GoogleTest is designed to have fairly minimal requirements to build and use with
your projects, but there are some. If you notice any problems on your platform,
please file an issue on the
[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues).
Patches for fixing them are welcome!
@ -119,7 +119,7 @@ These are the base requirements to build and use Google Test from a source
package:
* [Bazel](https://bazel.build/) or [CMake](https://cmake.org/). NOTE: Bazel is
the build system that googletest is using internally and tests against.
the build system that GoogleTest is using internally and tests against.
CMake is community-supported.
* A C++11-standard-compliant compiler

View File

@ -35,8 +35,8 @@ Details and examples can be found here:
* [gMock Cookbook](docs/cook_book.md)
* [gMock Cheat Sheet](docs/cheat_sheet.md)
Please note that code under scripts/generator/ is from the [cppclean
project](http://code.google.com/p/cppclean/) and under the Apache
Please note that code under scripts/generator/ is from the
[cppclean project](http://code.google.com/p/cppclean/) and under the Apache
License, which is different from GoogleMock's license.
GoogleMock is a part of

View File

@ -22,19 +22,31 @@ another project.
#### Standalone CMake Project
When building GoogleTest as a standalone project, the typical workflow starts
with:
mkdir mybuild # Create a directory to hold the build output.
cd mybuild
cmake ${GTEST_DIR} # Generate native build scripts.
If you want to build Google Test's samples, you should replace the last command
with
cmake -Dgtest_build_samples=ON ${GTEST_DIR}
```
git clone https://github.com/google/googletest.git -b release-1.10.0
cd googletest # Main directory of the cloned repository.
mkdir build # Create a directory to hold the build output.
cd build
cmake .. # Generate native build scripts for GoogleTest.
```
The above command also includes GoogleMock by default. And so, if you want to
build only GoogleTest, you should replace the last command with
```
cmake .. -DBUILD_GMOCK=OFF
```
If you are on a \*nix system, you should now see a Makefile in the current
directory. Just type 'make' to build gtest.
directory. Just type `make` to build GoogleTest. And then you can simply install
GoogleTest if you are a system administrator.
```
make
sudo make install # Install in /usr/local/ by default
```
If you use Windows and have Visual Studio installed, a `gtest.sln` file and
several `.vcproj` files will be created. You can then build them using Visual
@ -44,13 +56,19 @@ On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated.
#### Incorporating Into An Existing CMake Project
If you want to use gtest in a project which already uses CMake, then a more
robust and flexible approach is to build gtest as part of that project directly.
This is done by making the GoogleTest source code available to the main build
and adding it using CMake's `add_subdirectory()` command. This has the
significant advantage that the same compiler and linker settings are used
between gtest and the rest of your project, so issues associated with using
incompatible libraries (eg debug/release), etc. are avoided. This is
If you want to use GoogleTest in a project which already uses CMake, the easiest
way is to get installed libraries and headers.
* Import GoogleTest by using `find_package` (or `pkg_check_modules`). For
example, if `find_package(GTest CONFIG REQUIRED)` is succeed, you can use
the libraries as `GTest::gtest`, `GTest::gmock`.
And a more robust and flexible approach is to build GoogleTest as part of that
project directly. This is done by making the GoogleTest source code available to
the main build and adding it using CMake's `add_subdirectory()` command. This
has the significant advantage that the same compiler and linker settings are
used between GoogleTest and the rest of your project, so issues associated with
using incompatible libraries (eg debug/release), etc. are avoided. This is
particularly useful on Windows. Making GoogleTest's source code available to the
main build can be done a few different ways: