]> Creatis software - FrontAlgorithms.git/commitdiff
CMakeLists.txt updated
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 17 Apr 2015 21:45:12 +0000 (16:45 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 17 Apr 2015 21:45:12 +0000 (16:45 -0500)
CMakeLists.txt

index e652e5bd96773dc08b03a8a94fa87ae8216f466a..5182771b76c9d578a8a444d86ae29c953e1c6e3f 100644 (file)
@@ -45,14 +45,38 @@ ENDIF(BUILD_SHARED_LIBS)
 
 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)
 
 OPTION(USE_cpPlugins "Build cpPlugins based stuff" OFF)
 IF(USE_cpPlugins)