Browse Source

CTKImageProcessingITKCore - With ITKv4, link only to the required libraries

This commits ensure that CTKImageProcessingITKCore will link
against the needed set of libraries by specifying the corresponding
list of components.

This will help to address Slicer issue #3741.
Jean-Christophe Fillion-Robin 11 years ago
parent
commit
46b8a11530
1 changed files with 13 additions and 0 deletions
  1. 13 0
      Libs/ImageProcessing/ITK/Core/CMakeLists.txt

+ 13 - 0
Libs/ImageProcessing/ITK/Core/CMakeLists.txt

@@ -3,6 +3,19 @@ project(CTKImageProcessingITKCore)
 #
 #
 # 3rd party dependencies
 # 3rd party dependencies
 #
 #
+
+if(ITK_VERSION_MAJOR GREATER 3)
+  #
+  # ITK
+  #
+  set(ITK_FOUND 0) # XXX Ideally every library should 'find_package(ITK ...)" and the
+                   #     top-level call to find_package(ITK ...) should be removed.
+  set(${PROJECT_NAME}_ITK_COMPONENTS
+    ITKCommon
+    )
+  find_package(ITK 4 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
+  set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1)
+endif()
 include(${ITK_USE_FILE})
 include(${ITK_USE_FILE})
 
 
 #
 #