Skip to content

Commit 50e4477

Browse files
committed
lift goolge gtest to v1.17
1 parent dd8e465 commit 50e4477

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

dicom2mesh/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ option(TESTDICOM2MESH "Test Dicom2Mesh" OFF)
2020
IF(${TESTDICOM2MESH})
2121
MESSAGE(STATUS "Test dicom2mesh activated")
2222

23-
# Download and build gtest
24-
include(FetchContent)
25-
FetchContent_Declare(
26-
googletest
27-
# Specify the commit you depend on and update it regularly.
28-
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
29-
)
30-
# For Windows: Prevent overriding the parent project's compiler/linker settings
31-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
32-
FetchContent_MakeAvailable(googletest)
23+
if(NOT TARGET gtest_main)
24+
include(FetchContent)
25+
FetchContent_Declare(
26+
googletest
27+
URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.zip
28+
)
29+
# For Windows: Prevent overriding the parent project's compiler/linker settings
30+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
31+
FetchContent_MakeAvailable(googletest)
32+
endif()
3333

3434
FILE(GLOB_RECURSE D2M_TESTS_INC test/*.h)
3535
FILE(GLOB_RECURSE D2M_TESTS_SRC test/*.cpp)

lib/CMakeLists.txt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ option(TESTDICOM2MESHLIB "Test library" OFF)
6262
IF(${TESTDICOM2MESHLIB})
6363
MESSAGE(STATUS "Test library activated")
6464

65-
# Download and build gtest
66-
include(FetchContent)
67-
FetchContent_Declare(
68-
googletest
69-
# Specify the commit you depend on and update it regularly.
70-
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
71-
)
72-
# For Windows: Prevent overriding the parent project's compiler/linker settings
73-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
74-
FetchContent_MakeAvailable(googletest)
65+
if(NOT TARGET gtest_main)
66+
include(FetchContent)
67+
FetchContent_Declare(
68+
googletest
69+
URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.zip
70+
)
71+
# For Windows: Prevent overriding the parent project's compiler/linker settings
72+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
73+
FetchContent_MakeAvailable(googletest)
74+
endif()
7575

7676
FILE(GLOB_RECURSE D2M_LIB_TESTS_INC test/*.h)
7777
FILE(GLOB_RECURSE D2M_LIB_TESTS_SRC test/*.cpp)
@@ -81,4 +81,3 @@ IF(${TESTDICOM2MESHLIB})
8181
target_compile_features( runLibTests PRIVATE cxx_std_17 )
8282
target_compile_options( runLibTests PRIVATE -Wall -Wno-extra-semi )
8383
ENDIF()
84-

0 commit comments

Comments
 (0)