更新CMake配置,替换GoogleTest的FetchContent集成为find_package调用

This commit is contained in:
2025-11-04 10:38:15 +08:00
parent 60661a1153
commit 44625ac60a

View File

@@ -1,17 +1,6 @@
cmake_minimum_required(VERSION 3.20)
# ========================================
# GoogleTest 集成
# ========================================
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
# Windows 兼容性设置
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
find_package(gtest CONFIG REQUIRED)
# 启用测试
enable_testing()