]> Creatis software - crea.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Fri, 12 Dec 2008 08:38:51 +0000 (08:38 +0000)
committerguigues <guigues>
Fri, 12 Dec 2008 08:38:51 +0000 (08:38 +0000)
AdditionalcreaConfig.cmake.in
cmake/CREAMacro_FindAndUseLibraries.cmake

index ca0f68cb0a33046ec8786a7966807239848169a3..07bae21efbd4aab459a94d9b728457659cdf1ca7 100644 (file)
@@ -22,21 +22,25 @@ IF(CREA_VERBOSE_CMAKE)
 ENDIF(CREA_VERBOSE_CMAKE)
 #-----------------------------------------------------------------------------
 
-# If crea was compiled with WxWidget or vtk then have to find them : for now forced (see root CMakeLists.txt)  
+# If crea was compiled with WxWidget or vtk then have to find them 
 IF(CREA_BUILT_WITH_WX OR CREA_BUILT_WITH_VTK)
   INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_Define.cmake)
 ENDIF(CREA_BUILT_WITH_WX OR CREA_BUILT_WITH_VTK)
 IF(CREA_BUILT_WITH_WX)
-  MESSAGE(STATUS "=======================================")
-  MESSAGE(STATUS "crea was built with wxWidgets: have to find it...")
-  INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
-  CREA_FIND_AND_USE_WXWIDGETS()
+  IF(NOT wxWidgets_FOUND)
+    MESSAGE(STATUS "=======================================")
+    MESSAGE(STATUS "crea was built with wxWidgets: have to find it...")
+    INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
+    CREA_FIND_AND_USE_WXWIDGETS()
+  ENDIF(NOT wxWidgets_FOUND)
 ENDIF(CREA_BUILT_WITH_WX)
 IF(CREA_BUILT_WITH_VTK)
-  MESSAGE(STATUS "=======================================")
-  MESSAGE(STATUS "crea was built with VTK: have to find it...")
-  INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
-  CREA_FIND_AND_USE_VTK()
+  IF (NOT VTK_FOUND)
+    MESSAGE(STATUS "=======================================")
+    MESSAGE(STATUS "crea was built with VTK: have to find it...")
+    INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
+    CREA_FIND_AND_USE_VTK()
+  ENDIF (NOT VTK_FOUND)
 ENDIF(CREA_BUILT_WITH_VTK)
 
 
index 139c5cc29970d17e677228a866dd26774c06521e..2e5eedae65b21525636113327186d00899cf5852 100644 (file)
@@ -5,29 +5,31 @@ MACRO(CREA_FIND_AND_USE_LIBRARIES)
 #-----------------------------------------------------------------------------
 IF(USE_VTK)
   INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
-   CREA_FIND_AND_USE_VTK()  
+  CREA_FIND_AND_USE_VTK()  
 ENDIF(USE_VTK)
 #-----------------------------------------------------------------------------
 
 #-----------------------------------------------------------------------------
 IF(USE_KW)
-  # Search KWWidgets
-  FIND_PACKAGE(KWWidgets)
-  # If found
-  IF(KWWidgets_FOUND)
-    MESSAGE ( STATUS "=======================================")
-    MESSAGE ( STATUS "Looking for KWWidgets... found")
-    MESSAGE ( STATUS "* Dir     = ${KWWidgets_DIR}")
-    MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
-    INCLUDE(${KWWidgets_USE_FILE})
-    CREA_DEFINE( USE_KWWIDGETS )
-    SET(KWWIDGETS_LIBRARIES
-      ${KWWidgets_LIBRARIES}
-     ) 
-    MARK_AS_ADVANCED(KWWidgets_DIR)
-  ELSE(KWWidgets_FOUND)
-     message(FATAL_ERROR "KWWidgets_DIR not found")
-  ENDIF(KWWidgets_FOUND)
+  IF(NOT KWWidgets_FOUND)
+    # Search KWWidgets
+    FIND_PACKAGE(KWWidgets)
+    # If found
+    IF(KWWidgets_FOUND)
+      MESSAGE ( STATUS "=======================================")
+      MESSAGE ( STATUS "Looking for KWWidgets... found")
+      MESSAGE ( STATUS "* Dir     = ${KWWidgets_DIR}")
+      MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
+      INCLUDE(${KWWidgets_USE_FILE})
+      CREA_DEFINE( USE_KWWIDGETS )
+      SET(KWWIDGETS_LIBRARIES
+       ${KWWidgets_LIBRARIES}
+       ) 
+      MARK_AS_ADVANCED(KWWidgets_DIR)
+    ELSE(KWWidgets_FOUND)
+      message(FATAL_ERROR "KWWidgets_DIR not found")
+    ENDIF(KWWidgets_FOUND)
+  ENDIF(NOT KWWidgets_FOUND)
 ENDIF(USE_KW)
 #-----------------------------------------------------------------------------
 
@@ -35,126 +37,138 @@ ENDIF(USE_KW)
 
 #-----------------------------------------------------------------------------
 IF(USE_ITK)
-  # Search ITK
-  FIND_PACKAGE(ITK)
-  # If itk found
-  IF(ITK_FOUND)
-    MESSAGE ( STATUS "=======================================")
-    MESSAGE ( STATUS "Looking for ITK... found")
-    MESSAGE ( STATUS "* Dir     = ${ITK_DIR}")
-    MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
-    INCLUDE(${ITK_USE_FILE})
-    CREA_DEFINE( USE_ITK )
-    SET(ITK_LIBRARIES
-      ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
-      )  
-    MARK_AS_ADVANCED(ITK_DIR)
-  ELSE(ITK_FOUND)
-     message(FATAL_ERROR "ITK_DIR not found")
-  ENDIF(ITK_FOUND)
+  IF(NOT ITK_FOUND)
+    # Search ITK
+    FIND_PACKAGE(ITK)
+    # If itk found
+    IF(ITK_FOUND)
+      MESSAGE ( STATUS "=======================================")
+      MESSAGE ( STATUS "Looking for ITK... found")
+      MESSAGE ( STATUS "* Dir     = ${ITK_DIR}")
+      MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
+      INCLUDE(${ITK_USE_FILE})
+      CREA_DEFINE( USE_ITK )
+      SET(ITK_LIBRARIES
+       ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
+       )  
+      MARK_AS_ADVANCED(ITK_DIR)
+    ELSE(ITK_FOUND)
+      message(FATAL_ERROR "ITK_DIR not found")
+    ENDIF(ITK_FOUND)
+  ENDIF(NOT ITK_FOUND)
 ENDIF(USE_ITK)
 #-----------------------------------------------------------------------------
 
 
 #-----------------------------------------------------------------------------
 IF(USE_GDCM)
-  # Search GDCM
-  FIND_PACKAGE(GDCM)
-  # If gdcm found
-  IF(GDCM_FOUND)
-    INCLUDE(${GDCM_USE_FILE})
-    CREA_DEFINE( USE_GDCM )
-
-    MESSAGE ( STATUS "=======================================")
-    MESSAGE ( STATUS "Looking for GDCM... 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
+  IF (USE_GDCM2)
+    MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
+  ENDIF (USE_GDCM2)
+
+  IF(NOT GDCM_FOUND)
+    # Search GDCM
+    FIND_PACKAGE(GDCM)
+    # If gdcm found
+    IF(GDCM_FOUND)
+      INCLUDE(${GDCM_USE_FILE})
+      CREA_DEFINE( USE_GDCM )
+      
+      MESSAGE ( STATUS "=======================================")
+      MESSAGE ( STATUS "Looking for GDCM... 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)
+       )
+      
+      # 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(NOT GDCM_FOUND)
 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 "=======================================")
-    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
+  IF(NOT GDCM_FOUND)
+    # 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 "=======================================")
+      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)
+       )
+      
+      # 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(NOT GDCM_FOUND)
 ENDIF(USE_GDCM2)
 
 #-----------------------------------------------------------------------------
 
 #-----------------------------------------------------------------------------
 IF(USE_WXWIDGETS)
-  INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
-  CREA_FIND_WXWIDGETS()
-  CREA_USE_WXWIDGETS()
+  IF(NOT wxWidgets_FOUND)
+    INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
+    CREA_FIND_WXWIDGETS()
+    CREA_USE_WXWIDGETS()
+  ENDIF(NOT wxWidgets_FOUND)
 ENDIF(USE_WXWIDGETS)
 #-----------------------------------------------------------------------------
 
@@ -162,58 +176,65 @@ ENDIF(USE_WXWIDGETS)
 
 #-----------------------------------------------------------------------------
 IF(USE_DOXYGEN) 
-  MESSAGE ( STATUS "=======================================")
-  FIND_PACKAGE(Doxygen REQUIRED)
-#  MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
-  #  IF(DOXYGEN)
-#    
-#  ELSE(DOXYGEN)
-#    MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
-#  ENDIF(DOXYGEN)
+  IF(NOT DOXYGEN)
+    MESSAGE ( STATUS "=======================================")
+    FIND_PACKAGE(Doxygen REQUIRED)
+    #  MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
+    #  IF(DOXYGEN)
+    #    
+    #  ELSE(DOXYGEN)
+    #    MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
+  ENDIF(NOT DOXYGEN)
 ENDIF(USE_DOXYGEN)
 #-----------------------------------------------------------------------------
 
 
 #-----------------------------------------------------------------------------
 IF(USE_LATEX) 
-  FIND_PACKAGE(LATEX REQUIRED)
-  MESSAGE ( STATUS "=======================================")
-  MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
+  IF (NOT LATEX_COMPILER)
+    FIND_PACKAGE(LATEX REQUIRED)
+    MESSAGE ( STATUS "=======================================")
+    MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
+  ENDIF (NOT LATEX_COMPILER)
 ENDIF(USE_LATEX) 
 #-----------------------------------------------------------------------------
 
 #-----------------------------------------------------------------------------
 IF(USE_TTH) 
-  FIND_FILE(LATEX_tth_CONVERTER NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
-  IF (NOT LATEX_tth_CONVERTER)
-    MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
-  ELSE (NOT LATEX_tth_CONVERTER)
-    MESSAGE ( STATUS "=======================================")
-    MESSAGE ( STATUS "Looking for tth... - found ${LATEX_tth_CONVERTER}")
-  ENDIF(NOT LATEX_tth_CONVERTER)
-  MARK_AS_ADVANCED(LATEX_tth_CONVERTER)
+  IF (NOT TTH_EXECUTABLE)
+    FIND_FILE( TTH_EXECUTABLE NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
+    IF (NOT TTH_EXECUTABLE)
+      MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
+    ELSE (NOT  TTH_EXECUTABLE)
+      MESSAGE ( STATUS "=======================================")
+      MESSAGE ( STATUS "Looking for tth... - found ${TTH_EXECUTABLE}")
+    ENDIF(NOT TTH_EXECUTABLE)
+    MARK_AS_ADVANCED( TTH_EXECUTABLE )
+  ENDIF(NOT TTH_EXECUTABLE)
 ENDIF(USE_TTH)
 #-----------------------------------------------------------------------------
 
 #-----------------------------------------------------------------------------
 IF(USE_BOOST)
-  FIND_PACKAGE(Boost REQUIRED)
-  IF(Boost_FOUND)
-    MESSAGE ( STATUS "=======================================")
-    MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
-    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
-    LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
-    CREA_DEFINE( USE_BOOST )
-    IF(NOT WIN32)
-    SET(BOOST_LIBRARIES
-      boost_signals
-      boost_filesystem
-      )
+  IF(NOT Boost_FOUND)
+    FIND_PACKAGE(Boost REQUIRED)
+    IF(Boost_FOUND)
+      MESSAGE ( STATUS "=======================================")
+      MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
+      INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
+      LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
+      CREA_DEFINE( USE_BOOST )
+      IF(NOT WIN32)
+       SET(BOOST_LIBRARIES
+         boost_signals
+         boost_filesystem
+         )
       ENDIF(NOT WIN32)
-       MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
-  ELSE(Boost_FOUND)
-    MESSAGE(FATAL_ERROR "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
-  ENDIF(Boost_FOUND)
+      MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
+    ELSE(Boost_FOUND)
+      MESSAGE(FATAL_ERROR "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
+    ENDIF(Boost_FOUND)
+  ENDIF(NOT Boost_FOUND)
 ENDIF(USE_BOOST)
 #-----------------------------------------------------------------------------