From a5bbc6e405ab65a160bd6fd3b67ed8b5d3f148fc Mon Sep 17 00:00:00 2001 From: Seth Parker Date: Thu, 11 Jun 2026 15:06:13 -0400 Subject: [PATCH] cmake: drop include(${ITK_USE_FILE}) to scope ITK includes per-target The legacy UseITK.cmake pattern calls include_directories() at the directory in which it's invoked, which pollutes every downstream subdirectory's include path with -I (not -isystem) entries from ITK's bundled third-party headers. On macOS with Xcode 16's stricter libc++, those entries shadow the SDK's libc++ wrappers when GoogleTest is built via FetchContent under tests/, producing errors like: tried including but didn't find libc++'s core/ already links the ITK modules it needs as imported targets (ITKCommon, ITKTransform, ITKOptimizers, ITKIOTransform*), each of which propagates its own INTERFACE_INCLUDE_DIRECTORIES per-target. Dropping the global include is therefore safe and isolates ITK headers to the consumers that actually need them. --- cmake/FindDependencies.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/FindDependencies.cmake b/cmake/FindDependencies.cmake index c8fb674..e04202a 100644 --- a/cmake/FindDependencies.cmake +++ b/cmake/FindDependencies.cmake @@ -23,7 +23,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION V else() find_package(ITK REQUIRED) endif() -include(${ITK_USE_FILE}) set(ITKIOTransformLibs ITKIOTransformBase ITKIOTransformHDF5