From: Leonardo Florez-Valencia Date: Fri, 17 Apr 2015 21:45:12 +0000 (-0500) Subject: CMakeLists.txt updated X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=066ec14cc89c0972f23417fe982291074b1de14d;p=FrontAlgorithms.git CMakeLists.txt updated --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e652e5b..5182771 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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: +## +## :0:0: warning: "vtkRenderingCore_AUTOINIT" redefined +## :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)