From 8f36dedc17689f3c1498014dc99ff98bd5a6bf4e Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Mon, 21 Sep 2026 10:05:34 -0500 Subject: [PATCH] COMP: Build against ITK 6 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. --- CMakeLists.txt | 4 +++- include/itkStructurePreservingColorNormalizationFilter.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e3884a..ac05eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ cmake_minimum_required(VERSION 3.16.3) project(StructurePreservingColorNormalization) -set(CMAKE_CXX_STANDARD 14) if(NOT ITK_SOURCE_DIR) find_package(ITK REQUIRED) + if(NOT DEFINED CMAKE_CXX_STANDARD AND DEFINED ITK_CXX_STANDARD) + set(CMAKE_CXX_STANDARD ${ITK_CXX_STANDARD}) + endif() list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) include(ITKModuleExternal) else() diff --git a/include/itkStructurePreservingColorNormalizationFilter.h b/include/itkStructurePreservingColorNormalizationFilter.h index 7aaba5f..a7ed129 100644 --- a/include/itkStructurePreservingColorNormalizationFilter.h +++ b/include/itkStructurePreservingColorNormalizationFilter.h @@ -74,7 +74,7 @@ template class StructurePreservingColorNormalizationFilter : public ImageToImageFilter { public: - ITK_DISALLOW_COPY_AND_ASSIGN(StructurePreservingColorNormalizationFilter); + ITK_DISALLOW_COPY_AND_MOVE(StructurePreservingColorNormalizationFilter); /** Specific class typedefs */ using ImageType = TImage;