gogooletest,首先去github上下载
git clone https://github.com/google/googletest.git
然后切换到好的tag版本进行编译
git checkout -b 1.8 release-1.8.0
mkdir build
cd build
cmake ../
make
sudo make install
默认是安装在/usr/local/下面的
书写需要测试用的cmake,下面是从别的地方拷贝的一份,基本就是这么写的
cmake_minimum_required(VERSION 3.2)
project(gtest_test)
LINK_DIRECTORIES( ${PROJECT_SOURCE_DIR}/lib )
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/include )
add_executable(gtest_test Foomain.cpp)
#下面这条语句中,链接了gmock、gtest以及pthread
#pthread是必要的,因为前两者会用到
TARGET_LINK_LIBRARIES(gtest_test gmock gtest pthread)
install(TARGETS gtest_test RUNTIME DESTINATION bin)