File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -20,19 +20,22 @@ SET(CMAKE_BUILD_TYPE DEBUG)
20
20
################################################################################
21
21
# download and compile GTest
22
22
################################################################################
23
- INCLUDE (ExternalProject )
24
-
25
- # Download from GitHub
26
- INCLUDE (FetchContent )
27
- FetchContent_Declare (
28
- googletest
29
- URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip )
30
-
31
- # For Windows: Prevent overriding the parent project's compiler/linker settings
32
- SET (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
33
- FetchContent_MakeAvailable (googletest )
34
-
35
- INCLUDE (GoogleTest )
23
+ find_package (GTest )
24
+ if (NOT GTEST_FOUND )
25
+ INCLUDE (ExternalProject )
26
+
27
+ # Download from GitHub
28
+ INCLUDE (FetchContent )
29
+ FetchContent_Declare (
30
+ googletest
31
+ URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip )
32
+
33
+ # For Windows: Prevent overriding the parent project's compiler/linker settings
34
+ SET (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
35
+ FetchContent_MakeAvailable (googletest )
36
+
37
+ INCLUDE (GoogleTest )
38
+ endif ()
36
39
37
40
################################################################################
38
41
# add gtest dependency
You can’t perform that action at this time.
0 commit comments