COMP: Build against ITK 6 - #45
Open
hjmjohnson wants to merge 1 commit into
Open
hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
Two changes, both of which keep the module building against ITK 5.4 as well. The module pinned CMAKE_CXX_STANDARD to 14 before find_package(ITK). ITK 6 carries its own requirement on its imported targets, so the module's library compiled as C++17 regardless, but the wrapping subdirectory reads CMAKE_CXX_STANDARD directly to pick castxml's -std flag. castxml then parsed ITK 6 headers as C++14 and failed on std::is_convertible_v in itkSmartPointer.h. Take the standard from ITK_CXX_STANDARD, which both 5.4 and 6 export, and only when the caller has not already chosen one. ITK 6 also turns ITK_DISALLOW_COPY_AND_ASSIGN into a static assertion asking for ITK_DISALLOW_COPY_AND_MOVE, which ITK 5.4 defines as well.
hjmjohnson
marked this pull request as ready for review
September 22, 2026 16:05
dzenanz
approved these changes
Sep 22, 2026
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.
Build against ITK 6 while keeping ITK 5.4: take the C++ standard from
ITK_CXX_STANDARD(only when the caller has not set one) so castxml parses ITK 6 headers as C++17, and useITK_DISALLOW_COPY_AND_MOVE.Why the standard mattered
The module pinned
CMAKE_CXX_STANDARDto 14 beforefind_package(ITK). ITK 6's imported targets compile the library as C++17 regardless, but the wrapping readsCMAKE_CXX_STANDARDto pick castxml's-std, so castxml parsed ITK 6 headers as C++14 and failed onstd::is_convertible_vinitkSmartPointer.h.Verification
Configured with
ITK_DIRpointing at an installed ITK 6 tree (upstreammainas of 2026-09-22,ITK_WRAP_PYTHON=ON), built the module and its Python wrapping, and imported the wrapped module from Python. The module still builds against ITK 5.4.