Skip to content

Commit 299f754

Browse files
authored
Merge pull request InsightSoftwareConsortium#5791 from blowekamp/gtest_migration
DOC: Add migration guide to updated GTest target names
2 parents 8366558 + 1648e8e commit 299f754

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Documentation/docs/migration_guides/itk_6_migration_guide.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,34 @@ The handful of manually wrapped long double functions were
192192
removed from python wrapping.
193193

194194

195+
Legacy GoogleTest Target Names Removed
196+
--------------------------------------
197+
198+
ITK 6 now uses the standard CMake `FindGTest` target names for GoogleTest libraries, aligning with upstream project and CMake.
199+
200+
### Target Name Changes
201+
202+
**Before (ITK 5):**
203+
```cmake
204+
target_link_libraries(MyTest
205+
GTest::GTest # legacy target
206+
GTest::Main # legacy target
207+
)
208+
```
209+
210+
**After (ITK 6):**
211+
```cmake
212+
target_link_libraries(MyTest
213+
GTest::gtest # compatible target
214+
GTest::gtest_main # compatible target
215+
)
216+
```
217+
218+
### Rationale
219+
220+
These names were deprecated in CMake 3.20 and removed in CMake 4.1.0. Additionally, the GoogleTest project itself uses the lowercase target names (`GTest::gtest` and `GTest::gtest_main`), meaning the old ITK-specific aliases were not compatible when using GoogleTest directly from its upstream repository. ITK 6 adopts the standard lowercase target names to ensure compatibility with modern CMake versions, the GoogleTest project, and consistency with other projects.
221+
222+
195223
Modern CMake Interface Libraries
196224
---------------------------------
197225

0 commit comments

Comments
 (0)