Skip to content

Commit 1990ab4

Browse files
committed
ENH: Use GTest::gtest and GTest::gtest_main targets
These are the targets currently exported by CMake's FindGTest. Remove the GTest::GTest, and GTest::Main targets which depricated in CMake 3.20, and removed in CMake 4.1.0.
1 parent 5032829 commit 1990ab4

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

CMake/ITKModuleTest.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ function(CreateGoogleTestDriver KIT KIT_LIBS KitTests)
278278
target_link_libraries(
279279
${exe}
280280
${KIT_LIBS}
281-
GTest::GTest
282-
GTest::Main
281+
GTest::gtest
282+
GTest::gtest_main
283283
)
284284
target_link_options(
285285
${exe}

Modules/ThirdParty/GoogleTest/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(ITKGoogleTest_THIRD_PARTY 1)
44
if(ITK_USE_SYSTEM_GOOGLETEST)
55
if( NOT DEFINED GTEST_ROOT OR NOT EXISTS "${GTEST_ROOT}/CMakeLists.txt")
66
set(ITKGoogleTest_NO_SRC 1)
7-
set(ITKGoogleTest_LIBRARIES GTest::GTest GTest::Main)
7+
set(ITKGoogleTest_LIBRARIES GTest::gtest GTest::gtest_main)
88
set(ITKGoogleTest_EXPORT_CODE_BUILD "
99
if(NOT ITK_BINARY_DIR)
1010
set(GTEST_ROOT \"${GTEST_ROOT}\")

Modules/ThirdParty/GoogleTest/src/CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,8 @@ endif()
2929
add_subdirectory( "${GTEST_SRC}"
3030
"${CMAKE_CURRENT_BINARY_DIR}/GTest-build" EXCLUDE_FROM_ALL)
3131

32-
33-
# The standard CMake FindGTest exports namespace targets, create
34-
# similar name alias and export names
35-
36-
add_library(GTest::GTest ALIAS gtest)
37-
add_library(GTest::Main ALIAS gtest_main)
38-
39-
set_property(TARGET gtest PROPERTY EXPORT_NAME GTest::GTest)
40-
set_property(TARGET gtest_main PROPERTY EXPORT_NAME GTest::Main)
32+
set_property(TARGET gtest PROPERTY EXPORT_NAME GTest::gtest)
33+
set_property(TARGET gtest_main PROPERTY EXPORT_NAME GTest::gtest_main)
4134

4235
itk_module_target(gtest NO_INSTALL)
4336
itk_module_target(gtest_main NO_INSTALL)

0 commit comments

Comments
 (0)