]> Creatis software - crea.git/blobdiff - cmake/CREAMacro_FindAndUseLibraries.cmake
CMake 2.6 compatibility :
[crea.git] / cmake / CREAMacro_FindAndUseLibraries.cmake
index 0d2a29a8cedc1abd0c2e0f991af2484f149fb8f4..dda7ff9b7f76cca9ec1e40396c807f7f9d4757b5 100644 (file)
@@ -150,6 +150,55 @@ ENDIF(USE_GDCM)
 
 #-----------------------------------------------------------------------------
 
+#-----------------------------------------------------------------------------
+IF(USE_GDCM2)
+  # Search GDCM2
+  FIND_PACKAGE(GDCM)
+  # If gdcm found
+  IF(GDCM_FOUND)
+    INCLUDE(${GDCM_USE_FILE})
+    
+    IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
+      MESSAGE(FATAL_ERROR "gdcm version 2 needed. found ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}. Set GDCM_DIR to the gdcm version 2 directory")
+    ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
+
+    CREA_DEFINE( USE_GDCM2 )
+    CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
+
+    MESSAGE ( STATUS "Looking for GDCM2... found")
+    MESSAGE ( STATUS "* Dir       = ${GDCM_DIR}")
+    MESSAGE ( STATUS "* Version   = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
+    MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
+
+    # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with 
+    # embedded gdcm in ITK and will result in hard seg faults !
+    IF(USE_ITK)
+      IF (GDCM_NAME_SPACE STREQUAL "gdcm")
+       MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
+      ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
+    ENDIF(USE_ITK)
+    
+    MARK_AS_ADVANCED(GDCM_DIR)
+    
+    SET(GDCM_LIBRARIES
+        ${GDCM_LIBRARIES} 
+      )
+
+# TODO : Test that GDCM was built with option "vtkgdcm"
+    IF(USE_GDCM_VTK)
+     IF(USE_VTK)
+       SET(GDCM_LIBRARIES
+        ${GDCM_LIBRARIES}
+         vtkgdcm  
+         )
+     ENDIF(USE_VTK)
+    ENDIF(USE_GDCM_VTK)
+
+  ENDIF(GDCM_FOUND)
+ENDIF(USE_GDCM2)
+
+#-----------------------------------------------------------------------------
+
 #-----------------------------------------------------------------------------
 IF(USE_WXWIDGETS)
   INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_wxWidgets.cmake)