this note from Google! This tutorial is simple and easy to use, but may introduce nasty bugs.
1. Get the googletest framework
wget https://github.com /google/googletest/archive/release-1.8.0.tar.gz
Or get it before hand. I won’t keep this little method, so if you find it by accident and the link is out of date, please feel free Edit it.
2. Unzip and build Google test
tar xf release-1.8.0.tar.gz
cd googletest- release-1.8.0
cmake -DBUILD_SHARED_LIBS=ON .
make
3. “Install” headers and libraries on the system.
This step may It’s different from release to release, so make sure to copy the headers and libraries into the correct directory. I did this by checking where the Debians former gtest libs are. But I’m sure there is a better way to do it This. Note: make install is dangerous and not supported
$sudo cp -a include/gtest /usr/include
$sudo cp -a libgtest_main. so libgtest.so /usr/lib/
4. Update the linker’s cache
…and check if the GNU linker knows the library
$sudo ldconfig -v | grep gtest
If the output looks like this:
libgtest.so.0 -> libgtest.so.0.0 .0
libgtest_main.so.0 -> libgtest_main.so.0.0.0
, everything is fine.
gTestframework is now available. Just don’t forget to pass -lgtest is set as the linker flag to link the project with the library, and optionally, if you have not written your own test main program, use the explicit -lgtest_main flag.
From here, you May want to know about the framework of Google s documentation to understand how it works. Happy coding!
Edit:
This also applies to OS X! See “How to properly setup googleTest on OS X”
Debian no longer provides any pre-compiled packages for gTest. They recommend that you integrate the framework into your project’s makefile. But I want to keep the makefile clean. How can I set up gTest like the previous version (< 1.6.0) so that I can link to the library?
Before you start, make sure you have read and understood
this note from Google! This tutorial is simple and easy to use, but may introduce nasty bugs.
1. Get the googletest framework
wget https://github.com /google/googletest/archive/release-1.8.0.tar.gz
Or get it before hand. I won’t keep this little method, so if you find it by accident and the link is out of date, please feel free Edit it.
2. Unzip and build Google test
tar xf release-1.8.0.tar.gz
cd googletest- release-1.8.0
cmake -DBUILD_SHARED_LIBS=ON .
make
3. “Install” headers and libraries on the system.
This step may It’s different from release to release, so make sure to copy the headers and libraries into the correct directory. I did this by checking where the Debians former gtest libs are. But I’m sure there is a better way to do it This. Note: make install is dangerous and not supported
$sudo cp -a include/gtest /usr/include
$sudo cp -a libgtest_main. so libgtest.so /usr/lib/
4. Update the linker’s cache
…and check if the GNU linker knows the library
$sudo ldconfig -v | grep gtest
If the output looks like this:
libgtest.so.0 -> libgtest.so.0.0 .0
libgtest_main.so.0 -> libgtest_main.so.0.0.0
, everything is fine.
gTestframework is now available. Just don’t forget to pass -lgtest is set as the linker flag to link the project with the library, and optionally, if you have not written your own test main program, use the explicit -lgtest_main flag.
From here, you You may want to learn about the Googles documentation about the framework to understand how it works Management. Happy coding!
Edit:
This also applies to OS X! See “How to properly setup googleTest on OS X”