CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(YourProjectName)
在项目中查找并导入 Google Test
find_package(GTest REQUIRED)
将 gtest 头文件目录添加到 include 路径中
include_directories(${GTEST_INCLUDE_DIRS})
添加你的项目源文件和测试文件
add_executable(your_project_test your_project_test.cpp)
链接 gtest 库和 pthread 库(可能需要根据你的平台适应)
target_link_libraries(your_project_test ${GTEST_BOTH_LIBRARIES} pthread)