下載gtest
git clone https://github.com/google/googletest
gtest編譯
cd googletest
mkdir build
cd build
cmake ..
make -j8
執(zhí)行make,生成兩個靜態(tài)庫:libgtest.a libgtest_main.a
安裝
方式1蓄髓、make install
或者 sudo make install
方式2叉庐、拷貝到系統(tǒng)目錄,注意会喝,如果下訴目錄位置在不同版本位置有變動陡叠,用find . -name "libgtest*.a" 找到位置
sudo cp libgtest*.a? /usr/lib
sudo cp –a include/gtest /usr/include