Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
2d1a18ff
Commit
2d1a18ff
authored
Sep 15, 2020
by
Hyuk Myeong
Browse files
Apply the reviewed comment
parent
32437f41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
googletest/README.md
googletest/README.md
+17
-13
No files found.
googletest/README.md
View file @
2d1a18ff
...
...
@@ -22,21 +22,24 @@ another project.
#### Standalone CMake Project
When building Google Test as a standalone project, the typical workflow starts
with
:
with
git clone https://github.com/google/googletest.git -b release-1.10.0
cd googletest
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 Google Test
cmake .. # Generate native build scripts for Google Test
.
If you
are on a
\*
nix system, you should now see a Makefile in the current
directory. Just type
`make`
to build gtest.
If you
want to build without Google Mock, you should replace the last command
with
make
c
make
.. -DBUILD_GMOCK=OFF
And if you are a system administrator, you can simply install Google Test.
If you are on a
\*
nix system, you should now see a Makefile in the current
directory. Just type
`make`
to build Google Test. And then you can simply
install Google Test 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
...
...
@@ -47,18 +50,19 @@ On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated.
#### Incorporating Into An Existing CMake Project
The easiest way to use Google Test is importing installed libraries and headers.
If you want to use Google Test in a project which already uses CMake,
the easiest way is to get installed libraries and headers.
*
Import Google Test 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
gt
est as part of that
project
directly. This is done by making the Google Test source code available
to the
main build and adding it using CMake's
`add_subdirectory()`
command.
And a more robust and flexible approach is to build
Google T
est as part of that
project
directly. This is done by making the Google Test 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
gt
est and the rest of your project, so issues associated
with
using incompatible libraries (eg debug/release), etc. are avoided. This is
are used between
Google T
est 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 Google Test's source code available to the
main build can be done a few different ways:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment