Replaced GoogleTest submodule with FetchContent statement in CMake

This commit is contained in:
Yizhou Sheng 2021-08-06 07:38:33 -07:00
Родитель 63d67e700a
Коммит 3168b54e0e
3 изменённых файлов: 8 добавлений и 15 удалений

3
.gitmodules поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
[submodule "googletest/googletest"]
path = googletest/googletest
url = git@github.com:google/googletest.git

Просмотреть файл

@ -1,17 +1,14 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
add_subdirectory(googletest)
include(FetchContent)
# Note: Must set the code generation flag to Multi-threaded Debug (/MTd) to compile with Google Test
# Workaround referenced from https://gitlab.kitware.com/cmake/community/-/wikis/FAQ
foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
if(${flag_var} MATCHES "/MDd")
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
endif()
endforeach()
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master # Live at head
)
FetchContent_MakeAvailable(googletest)
project(DirectX-Headers-GoogleTest-Suite CXX)
add_executable(Feature-Support-Test feature_support_test.cpp)

@ -1 +0,0 @@
Subproject commit 8d51ffdfab10b3fba636ae69bc03da4b54f8c235