Windows篇-在windows-10上源码编译gtest-并编写CMakeListstxt

30次阅读

共计 962 个字符,预计需要花费 3 分钟才能阅读完成。

本文首发于个人博客 https://kezunlin.me/post/aca50ff8/,欢迎阅读!

compile gtest on windows 10
<!–more–>

Guide

  • compile gtest on ubuntu 16.04
  • compile gtest on windows 10

download

wget https://github.com/google/googletest/archive/release-1.8.0.zip 

compile

mkdir build 
cd build
sudo cmake-gui ..

with options

BUILD_SHARED_LIBS ON
CMAKE_CONFIGURATION_TYPES Release

compile and install gtest to C:\Program Files\gtest.

CMakeLists.txt

if(MSVC) 
    SET(GTEST_ROOT "C:/Program Files/gtest")
else()
    # BOOST_THREAD_LIBRARY  /usr/lib/x86_64-linux-gnu/libpthread.so
    MESSAGE([Main] "BOOST_THREAD_LIBRARY = ${BOOST_THREAD_LIBRARY}")
endif(MSVC)

find_package(GTest REQUIRED) # GTest 1.8.0

find_package(GTest REQUIRED) # GTest 1.8.0
include_directories(${GTEST_INCLUDE_DIRS})
target_link_libraries(demo ${GTEST_LIBRARIES} ${BOOST_THREAD_LIBRARY})

Reference

  • compile gtest on ubuntu 16.04

History

  • 20180301: created.

Copyright

  • Post author: kezunlin
  • Post link: https://kezunlin.me/post/aca50ff8/
  • Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.

正文完
 0