#=================================================================
# file:         gtest.cmake
# Copyright (c) 2020-2021 moe-org 保留所有权利
#=================================================================
include(FetchContent)

FetchContent_Declare(
	googletest
	GIT_REPOSITORY		https://github.com/google/googletest
	GIT_TAG				"main"
	SOURCE_DIR			"${U_LIBRARY_DIR}/googletest"
)

# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(
	googletest
)

include(GoogleTest)

# 链接
target_link_libraries(
  ${U_CORE_LIBRARY_TEST}
  gtest_main
)
target_link_libraries(
  ${U_SERVER_EXECUTABLE_TEST}
  gtest_main
)
target_link_libraries(
  ${U_CLIENT_EXECUTABLE_TEST}
  gtest_main
)
gtest_discover_tests(${U_CORE_LIBRARY_TEST})
gtest_discover_tests(${U_SERVER_EXECUTABLE_TEST})
gtest_discover_tests(${U_CLIENT_EXECUTABLE_TEST})
