本来以为像之前链接boost一样,加个链接路径就好了,没想到报找不到gtest的符号,搞了半天,没弄明白啥原因。

网上也没搜到好方法,只能把gtest的源码加到项目里,然后在链接了。

 

CMake配置如下:

set(googleTestDir "C:/Users/z00199662/CLionProjects/MyCppProject/googletest-master")
#Add the google test subdirectory
add_subdirectory(${googleTestDir})
#include googletest/include dir
include_directories(${googleTestDir}/googletest/include)
#include the googlemock/include dir
include_directories(${googleTestDir}/googlemock/include)

# Link with GoogleTest
target_link_libraries(MyCppProject gtest gtest_main)
#Link with GoogleMock
target_link_libraries(MyCppProject gmock gmock_main)

相关文章:

  • 2021-09-16
  • 2021-03-31
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2022-02-10
猜你喜欢
  • 2021-04-29
  • 2021-05-17
  • 2022-12-23
  • 2021-07-20
  • 2021-10-08
  • 2022-12-23
  • 2022-02-02
相关资源
相似解决方案