cd /usr/local/src/
proxychains wget https://github.com/google/googletest/archive/release-1.8.1.tar.gz
tar -xzvf release-1.8.1.tar.gz
cd googletest-release-1.8.1/
mkdir build
cd build
cmake ../
make && make install
方法2
1
2
3
4
5
6
7
sudo apt install libgtest-dev
cd /usr/src/gtest/
mkdir build
cd build
sudo cmake ..
sudo make
cp ./lib/*.a /usr/local/lib/
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from add
[ RUN ] add.case1
test_demo.cpp:5: Failure
Expected: (2) < (add(0, 2)), actual: 2 vs 2
[ FAILED ] add.case1 (0 ms)
[----------] 1 test from add (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] add.case1