From d72223cf80b1703d6f6b31e749af5ffe2e96cbfb Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Fri, 17 Apr 2015 16:31:16 -0500 Subject: [PATCH] CMakeLists.txt updated --- CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d6af75..61a150b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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: +## +## :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) IF(USE_QT4) FIND_PACKAGE(Qt4 REQUIRED) -- 2.47.1