From 98b8f7ba828433025355f177cf01eb5344eac442 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Tue, 16 Jun 2026 20:49:23 +0000 Subject: [PATCH 1/2] WIP: Use interface libraries --- .../CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt b/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt index 62596ffa7..b671c686f 100644 --- a/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt +++ b/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt @@ -6,16 +6,17 @@ set(test_options 5 0.125 3.0) project(ComputeCurvatureAnisotropicDiffusion) -find_package(ITK REQUIRED) +find_package(ITK REQUIRED COMPONENTS + ITKImageBase + ITKAnisotropicSmoothingModule + ITKImageIntensityModule +) itk_generate_factory_registration() add_executable(${PROJECT_NAME} Code.cxx) -target_link_libraries(${PROJECT_NAME} - PRIVATE - ITK::ITKImageIO - ITK::ITKAnisotropicSmoothingModule - ITK::ITKImageIntensityModule -) +message(STATUS "ITK_FACTORY_LIST: ${ITK_FACTORY_LIST}") +message(STATUS "ITK_INTERFACE_LIBRARIES: ${ITK_INTERFACE_LIBRARIES}") +target_link_libraries(${PROJECT_NAME} PRIVATE ${ITK_INTERFACE_LIBRARIES} ITKImageIO) install(TARGETS ${PROJECT_NAME} DESTINATION bin/ITKSphinxExamples/Filtering/AnisotropicSmoothing From 0f0000955a071c6c64aab89ff7f3f1762e762758 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 11 Sep 2026 15:38:55 -0500 Subject: [PATCH 2/2] COMP: Name ITK modules, not targets, in find_package COMPONENTS find_package(ITK COMPONENTS ...) takes module names; the ITK::...Module spellings are target names. ITKImageBase, ITKAnisotropicSmoothingModule, and ITKImageIntensityModule are not modules, so ITKModuleAPI.cmake stops with "No such module". List ITKIOImageBase, ITKAnisotropicSmoothing, ITKImageIntensity, and the ITKImageIO factory meta-module, and link ITK::ITKImageIO as the ITK 6 migration guide shows. Built against ITK main, the executable links the same 52 ITK libraries and registers the same 24 ImageIO factories as the explicit-target form, and its output is byte-identical. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01S5zzoU6yyUwdLEvjM2s6iS --- .../CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt b/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt index 58fd03977..55e6898e3 100644 --- a/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt +++ b/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt @@ -15,20 +15,19 @@ find_package( ITK REQUIRED COMPONENTS - ITKImageBase - ITKAnisotropicSmoothingModule - ITKImageIntensityModule + ITKIOImageBase + ITKAnisotropicSmoothing + ITKImageIntensity + ITKImageIO ) itk_generate_factory_registration() add_executable(${PROJECT_NAME} Code.cxx) -message(STATUS "ITK_FACTORY_LIST: ${ITK_FACTORY_LIST}") -message(STATUS "ITK_INTERFACE_LIBRARIES: ${ITK_INTERFACE_LIBRARIES}") target_link_libraries( ${PROJECT_NAME} PRIVATE ${ITK_INTERFACE_LIBRARIES} - ITKImageIO + ITK::ITKImageIO ) install(