INCLUDE(GenerateExportHeader)
-FIND_PACKAGE(VTK REQUIRED)
-FIND_PACKAGE(ITK REQUIRED)
-INCLUDE(${ITK_USE_FILE})
-
-## Check for required modules
-IF(NOT ITKVtkGlue_LOADED)
- MESSAGE(FATAL_ERROR "ITKVtkGlue module is required but not available.")
-ENDIF(NOT ITKVtkGlue_LOADED)
+## -------------------------------------------------------------------------
+## If compiling on UNIX-like OS, an error could arise when using ITKVtkGlue:
+##
+## <command-line>:0:0: warning: "vtkRenderingCore_AUTOINIT" redefined
+## <command-line>:0:0: note: this is the location of the previous definition
+##
+## This is avoided by not including the VTK_USE_FILE. Nevertheless, this fails
+## on MS-Win OS.
+##
+## This is due to object factories. To avoid this, and let the project be
+## usable on UNIX-like and MS-Win, the way to find ITK and VTK differs
+## -------------------------------------------------------------------------
+
+IF(UNIX)
+ FIND_PACKAGE(ITK REQUIRED)
+ FIND_PACKAGE(VTK REQUIRED)
+ INCLUDE(${ITK_USE_FILE})
+ IF(NOT ITKVtkGlue_LOADED)
+ MESSAGE(FATAL_ERROR "ITKVtkGlue module is required but not available.")
+ ENDIF(NOT ITKVtkGlue_LOADED)
+ELSE(UNIX)
+ FIND_PACKAGE(ITK REQUIRED)
+ INCLUDE(${ITK_USE_FILE})
+ IF(ITKVtkGlue_LOADED)
+ FIND_PACKAGE(VTK REQUIRED)
+ INCLUDE(${VTK_USE_FILE})
+ ELSE(ITKVtkGlue_LOADED)
+ FIND_PACKAGE(ItkVtkGlue REQUIRED)
+ INCLUDE(${ItkVtkGlue_USE_FILE})
+ SET(Glue ItkVtkGlue)
+ ENDIF(ITKVtkGlue_LOADED)
+ENDIF(UNIX)
IF(USE_QT4)
FIND_PACKAGE(Qt4 REQUIRED)