compile gtest on windows 10


Series

Guide

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

History

  • 20180301: created.

Author: kezunlin
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source kezunlin !
评论
  TOC