Skip to content

Commit 0672316

Browse files
committed
feat(CMake): Add GoogleTest as dependencies
Reference: https://google.github.io/googletest/quickstart-cmake.html
1 parent ebe8eda commit 0672316

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,21 @@ project(cplusplus)
44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
66

7+
###
8+
# START - For setting up Google Test
9+
# Reference: https://google.github.io/googletest/quickstart-cmake.html#set-up-a-project
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
12+
include(FetchContent)
13+
FetchContent_Declare(
14+
googletest
15+
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
16+
)
17+
# For Windows: Prevent overriding the parent project's compiler/linker settings
18+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
19+
FetchContent_MakeAvailable(googletest)
20+
21+
# END - For setting up Google Test
22+
###
23+
724
add_executable(cplusplus main.cpp)

0 commit comments

Comments
 (0)