File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,20 +11,27 @@ if(CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
1111 add_link_options (-static-intel )
1212endif ()
1313
14- include (FetchContent )
15- FetchContent_Declare (
16- googletest
17- GIT_REPOSITORY https://github.com/google/googletest.git
18- GIT_TAG v1.15.2)
19-
20- # For Windows: Prevent overriding the parent project's compiler/linker settings
21- set (gtest_force_shared_crt
22- ON
23- CACHE BOOL "" FORCE )
24- set (INSTALL_GTEST
25- OFF
26- CACHE BOOL "" FORCE )
27- FetchContent_MakeAvailable (googletest)
14+ set (GTEST_VER 1.15.2)
15+
16+ find_package (GTest ${GTEST_VER} QUIET )
17+
18+ if (NOT GTest_FOUND)
19+ include (FetchContent )
20+ FetchContent_Declare (
21+ googletest
22+ GIT_REPOSITORY https://github.com/google/googletest.git
23+ GIT_TAG v${GTEST_VER} )
24+
25+ # For Windows: Prevent overriding the parent project's compiler/linker
26+ # settings
27+ set (gtest_force_shared_crt
28+ ON
29+ CACHE BOOL "" FORCE )
30+ set (INSTALL_GTEST
31+ OFF
32+ CACHE BOOL "" FORCE )
33+ FetchContent_MakeAvailable (googletest)
34+ endif ()
2835enable_testing ()
2936
3037set (UMF_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR } )
You can’t perform that action at this time.
0 commit comments