编译安装libgtest
i7@pc:~$ sudo apt-get install libgtest-dev
[sudo] i7 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会同时安装下列软件:
googletest
下列【新】软件包将被安装:
googletest libgtest-dev
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 658 kB 的归档。
解压缩后会消耗 7,608 kB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 http://packages.deepin.com/deepin panda/main amd64 googletest amd64 1.8.0-6 [653 kB]
获取:2 http://packages.deepin.com/deepin panda/main amd64 libgtest-dev amd64 1.8.0-6 [5,110 B]
已下载 658 kB,耗时 1分 7秒 (9,711 B/s)
正在选中未选择的软件包 googletest:amd64。
(正在读取数据库 ... 系统当前共安装有 198108 个文件和目录。)
正准备解包 .../googletest_1.8.0-6_amd64.deb ...
正在解包 googletest:amd64 (1.8.0-6) ...
正在选中未选择的软件包 libgtest-dev:amd64。
正准备解包 .../libgtest-dev_1.8.0-6_amd64.deb ...
正在解包 libgtest-dev:amd64 (1.8.0-6) ...
正在设置 googletest:amd64 (1.8.0-6) ...
正在设置 libgtest-dev:amd64 (1.8.0-6) ...
正在处理用于 man-db (2.7.6.1-2) 的触发器 ...
i7@pc:~$ cd /usr/src/gtest
i7@pc:/usr/src/gtest$ sudo mkdir build
i7@pc:/usr/src/gtest$ cd build
i7@pc:/usr/src/gtest/build$ sudo cmake ..
-- The CXX compiler identification is GNU 6.4.0
-- The C compiler identification is GNU 6.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.13")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/googletest/googletest/build
i7@pc:/usr/src/gtest/build$ sudo make
Scanning dependencies of target gtest
[ 25%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 50%] Linking CXX static library libgtest.a
[ 50%] Built target gtest
Scanning dependencies of target gtest_main
[ 75%] Building CXX object CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library libgtest_main.a
[100%] Built target gtest_main
i7@pc:/usr/src/gtest/build$ sudo make install
[ 50%] Built target gtest
[100%] Built target gtest_main
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libgtest.a
-- Installing: /usr/local/lib/libgtest_main.a
-- Installing: /usr/local/include/gtest
-- Installing: /usr/local/include/gtest/gtest-printers.h
-- Installing: /usr/local/include/gtest/gtest-param-test.h.pump
-- Installing: /usr/local/include/gtest/gtest-spi.h
-- Installing: /usr/local/include/gtest/gtest-death-test.h
-- Installing: /usr/local/include/gtest/gtest-param-test.h
-- Installing: /usr/local/include/gtest/gtest-typed-test.h
-- Installing: /usr/local/include/gtest/gtest-message.h
-- Installing: /usr/local/include/gtest/gtest_prod.h
-- Installing: /usr/local/include/gtest/internal
-- Installing: /usr/local/include/gtest/internal/gtest-port-arch.h
-- Installing: /usr/local/include/gtest/internal/gtest-param-util.h
-- Installing: /usr/local/include/gtest/internal/gtest-string.h
-- Installing: /usr/local/include/gtest/internal/gtest-death-test-internal.h
-- Installing: /usr/local/include/gtest/internal/gtest-linked_ptr.h
-- Installing: /usr/local/include/gtest/internal/gtest-filepath.h
-- Installing: /usr/local/include/gtest/internal/gtest-param-util-generated.h.pump
-- Installing: /usr/local/include/gtest/internal/gtest-param-util-generated.h
-- Installing: /usr/local/include/gtest/internal/gtest-internal.h
-- Installing: /usr/local/include/gtest/internal/custom
-- Installing: /usr/local/include/gtest/internal/custom/gtest-printers.h
-- Installing: /usr/local/include/gtest/internal/custom/gtest-port.h
-- Installing: /usr/local/include/gtest/internal/custom/gtest.h
-- Installing: /usr/local/include/gtest/internal/gtest-type-util.h
-- Installing: /usr/local/include/gtest/internal/gtest-type-util.h.pump
-- Installing: /usr/local/include/gtest/internal/gtest-tuple.h.pump
-- Installing: /usr/local/include/gtest/internal/gtest-port.h
-- Installing: /usr/local/include/gtest/internal/gtest-tuple.h
-- Installing: /usr/local/include/gtest/gtest_pred_impl.h
-- Installing: /usr/local/include/gtest/gtest.h
-- Installing: /usr/local/include/gtest/gtest-test-part.h