24 lines
653 B
CMake
24 lines
653 B
CMake
![]() |
include(FetchContent)
|
||
|
|
||
|
set(GOOGLETEST_DIR "" CACHE STRING "Location of local GoogleTest repo to build against")
|
||
|
|
||
|
if(GOOGLETEST_DIR)
|
||
|
set(FETCHCONTENT_SOURCE_DIR_GOOGLETEST ${GOOGLETEST_DIR} CACHE STRING "GoogleTest source directory override")
|
||
|
endif()
|
||
|
|
||
|
FetchContent_Declare(
|
||
|
googletest
|
||
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||
|
GIT_TAG release-1.12.1
|
||
|
)
|
||
|
|
||
|
FetchContent_GetProperties(googletest)
|
||
|
|
||
|
if(NOT googletest_POPULATED)
|
||
|
FetchContent_Populate(googletest)
|
||
|
if (MSVC)
|
||
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||
|
endif()
|
||
|
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||
|
endif()
|