Improves the instructions in README.

This commit is contained in:
shiqian 2008-12-11 03:22:43 +00:00
parent 3bcc7a2173
commit 92764e9c93

56
README
View File

@ -77,16 +77,23 @@ or for a release version X.Y.*'s branch:
Next you will need to prepare the GNU Autotools build system, if you Next you will need to prepare the GNU Autotools build system, if you
are using Linux, Mac OS X, or Cygwin. Enter the target directory of are using Linux, Mac OS X, or Cygwin. Enter the target directory of
the checkout command you used ('gtest-svn' or 'gtest-X.Y-svn' above) the checkout command you used ('gtest-svn' or 'gtest-X.Y-svn' above)
and proceed with the following command to bootstrap the build system: and proceed with the following command:
$ ACLOCAL=aclocal-1.9 AUTOMAKE=automake-1.9 autoreconf -fiv $ autoreconf -fvi
You can substitute newer versions of 'aclocal' and 'automake', but be aware Once you have completed this step, you are ready to build the library. Note
that older versions are known not to work, and autoreconf may or may not that you should only need to complete this step once. The subsequent `make'
correctly detect the required version. Also, the versions must match for both invocations will automatically re-generate the bits of the build system that
commands. However, this entire process will be automatically re-run by your need to be changed.
"make" invocations, so in practice you shouldn't need to worry too much. Once
you have completed these steps, you are ready to build the library. If your system uses older versions of the autotools, the above command will
fail. You may need to explicitly specify a version to use. For instance, if you
have both GNU Automake 1.4 and 1.9 installed and `automake' would invoke the
1.4, use instead:
$ AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -fvi
Make sure you're using the same version of automake and aclocal.
### Source Package: ### ### Source Package: ###
Google Test is also released in source packages which can be downloaded from Google Test is also released in source packages which can be downloaded from
@ -131,21 +138,30 @@ libraries to leverage it:
$ sudo make install # Not necessary, but allows use by other programs $ sudo make install # Not necessary, but allows use by other programs
TODO(chandlerc@google.com): This section needs to be expanded when the Should you need to remove Google Test from your system after having installed
'gtest-config' script is finished and Autoconf macro's are provided (or not it, run the following command, and it will back out its changes. However, note
provided) in order to properly reflect the process for other programs to carefully that you must run this command on the *same* Google Test build that
locate, include, and link against Google Test. you ran the install from, or the results are not predictable. If you install
Google Test on your system, and are working from a VCS checkout, make sure you
Finally, should you need to remove Google Test from your system after having run this *before* updating your checkout of the source in order to uninstall
installed it, run the following command, and it will back out its changes. the same version which you installed.
However, note carefully that you must run this command on the *same* Google
Test build that you ran the install from, or the results are not predictable.
If you install Google Test on your system, and are working from a VCS checkout,
make sure you run this *before* updating your checkout of the source in order
to uninstall the same version which you installed.
$ sudo make uninstall # Must be run against the exact same build as "install" $ sudo make uninstall # Must be run against the exact same build as "install"
Your project can build against Google Test simply by leveraging the
'gtest-config' script. This script can be invoked directly out of the 'scripts'
subdirectory of the build tree, and it will be installed in the binary
directory specified during the 'configure'. Here are some examples of its use,
see 'gtest-config --help' for more detailed information.
$ gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
$ g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
$ g++ $(gtest-config --ldflags --libs) -o foo foo.o
# When using a built but not installed Google Test:
$ g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
### Windows ### ### Windows ###
Open the gtest.sln file in the msvc/ folder using Visual Studio, and Open the gtest.sln file in the msvc/ folder using Visual Studio, and
you are ready to build Google Test the same way you build any Visual you are ready to build Google Test the same way you build any Visual