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

index 1d6af7523fb31f826af49c1c257f5c6c7556fabc..61a150b6b0dac6911d9ca81517b2ab828f50445a 100644 (file)
@@ -42,14 +42,38 @@ OPTION(BUILD_EXAMPLES "Build examples" OFF)
 
 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)