Add using ITK with CMake's FetchContent module#2475
Merged
blowekamp merged 3 commits intoSimpleITK:mainfrom Jan 12, 2026
Merged
Add using ITK with CMake's FetchContent module#2475blowekamp merged 3 commits intoSimpleITK:mainfrom
blowekamp merged 3 commits intoSimpleITK:mainfrom
Conversation
4a79b78 to
79e5b7a
Compare
Member
Author
|
There is an issue when SimpleITK_EXPLICIT_INSTANTIATION is enabled. With using ITK FetchContent, the include path as just the build, and the targets do not have installation targets. When the SimpleITK Explicit library declare a public interface with ITK, the ITK include paths are the build only. |
ba29d7d to
b426a0d
Compare
7 tasks
e98f5fb to
8ae6219
Compare
73857f7 to
dd976ad
Compare
Don't set ExternalData_SOURCE_ROOT if the default will work. This help with using FetchContent with other projects.
zivy
approved these changes
Jan 12, 2026
| set(ITK_USE_KWSTYLE OFF) | ||
|
|
||
| # ITK automatically checks COMPILER_LAUNCHER variables to automatically enable ccache option. | ||
| # However additional contrains and usages are added, that are not needed for |
Member
There was a problem hiding this comment.
"ITK automatically checks COMPILER_LAUNCHER variables to automatically..." -> drop first "automatically", "ITK checks COMPILER_LAUNCHER variables to automatically..."
Second sentence is not complete, not sure about the intention ("However...").
|
|
||
| #set(ExternalData_SOURCE_ROOT ${ITK_SOURCE_DIR}) | ||
| #message(STATUS "ITK source root for ExternalData: ${ExternalData_SOURCE_ROOT}") | ||
| FetchContent_MakeAvailable(ITK) |
dave3d
approved these changes
Jan 12, 2026
Add additional builds which disables superbuild.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation on CMake's FetchContent can be found here:
https://cmake.org/cmake/help/latest/module/FetchContent.html
This is an experimental option for SimpleITK as an alternative to the Superbuild. With this change the Superbuild build of ITK still works, and the SimpleITK project still respects ITK_DIR with the FetchContent trying to use
find_package(ITK)to determine if ITK needs to build built.If ITK needs to be built with FetchContent, then ITK is downloaded, and configured during SimpleITK's configuration. And ITK shares the same CMake configuration cache with the SimpleITK project to enable consistent, and easier tuning of the ITK build through the SimpleITK project.