MACRO(CREA_FIND_AND_USE_LIBRARIES) #----------------------------------------------------------------------------- IF(USE_VTK) # Search VTK FIND_PACKAGE(VTK) # If vtk found IF(VTK_FOUND) MESSAGE ( STATUS "Looking for VTK... found") MESSAGE ( STATUS "* Dir = ${VTK_DIR}") MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}") INCLUDE(${VTK_USE_FILE}) CREA_DEFINE( USE_VTK ) SET(VTK_LIBRARIES vtkImaging vtkGraphics vtkRendering vtkFiltering vtkCommon vtkWidgets vtkVolumeRendering # LG : removed vtkIO because conflict with itktiff lib in ITKIO ) IF(NOT USE_ITK) SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO) ENDIF(NOT USE_ITK) MARK_AS_ADVANCED(VTK_DIR) ELSE(VTK_FOUND) message(FATAL_ERROR "VTK_DIR not found") ENDIF(VTK_FOUND) ENDIF(USE_VTK) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- IF(USE_ITK) # Search ITK FIND_PACKAGE(ITK) # If itk found IF(ITK_FOUND) 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) # images compilation option OPTION ( itk_IMAGE_DIM_2 "itk : Compile 2D images" ON) OPTION ( itk_IMAGE_DIM_3 "itk : Compile 3D images" ON) OPTION ( itk_IMAGE_DIM_4 "itk : Compile 4D images" ON) OPTION ( itk_IMAGE_TYPE_CHAR "itk : Compile char images" ON) OPTION ( itk_IMAGE_TYPE_UCHAR "itk : Compile unsigned char images" ON) OPTION ( itk_IMAGE_TYPE_SHORT "itk : Compile short images" ON) OPTION ( itk_IMAGE_TYPE_USHORT "itk : Compile unsigned short images" ON) OPTION ( itk_IMAGE_TYPE_INT "itk : Compile int images" ON) OPTION ( itk_IMAGE_TYPE_UINT "itk : Compile unsigned int images" ON) OPTION ( itk_IMAGE_TYPE_FLOAT "itk : Compile float images" ON) OPTION ( itk_IMAGE_TYPE_DOUBLE "itk : Compile double images" ON) IF ( itk_IMAGE_DIM_2 ) CREA_DEFINE( BBTK_ITK_IMAGE_DIM_2 ) ENDIF ( itk_IMAGE_DIM_2 ) IF ( itk_IMAGE_DIM_3 ) CREA_DEFINE( BBTK_ITK_IMAGE_DIM_3 ) ENDIF ( itk_IMAGE_DIM_3 ) IF ( itk_IMAGE_DIM_4 ) CREA_DEFINE( BBTK_ITK_IMAGE_DIM_4 ) ENDIF ( itk_IMAGE_DIM_4 ) IF ( itk_IMAGE_TYPE_CHAR ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_int8_t ) ENDIF ( itk_IMAGE_TYPE_CHAR ) IF ( itk_IMAGE_TYPE_UCHAR ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_uint8_t ) ENDIF ( itk_IMAGE_TYPE_UCHAR ) IF ( itk_IMAGE_TYPE_SHORT ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_int16_t ) ENDIF ( itk_IMAGE_TYPE_SHORT ) IF ( itk_IMAGE_TYPE_USHORT ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_uint16_t ) ENDIF ( itk_IMAGE_TYPE_USHORT ) IF ( itk_IMAGE_TYPE_INT ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_int32_t ) ENDIF ( itk_IMAGE_TYPE_INT ) IF ( itk_IMAGE_TYPE_UINT ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_uint32_t ) ENDIF ( itk_IMAGE_TYPE_UINT ) IF ( itk_IMAGE_TYPE_FLOAT ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_float ) ENDIF ( itk_IMAGE_TYPE_FLOAT ) IF ( itk_IMAGE_TYPE_DOUBLE ) CREA_DEFINE( BBTK_ITK_IMAGE_TYPE_double ) ENDIF ( itk_IMAGE_TYPE_DOUBLE ) ELSE(ITK_FOUND) message(FATAL_ERROR "ITK_DIR not found") ENDIF(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 "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) ENDIF(USE_GDCM) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- IF(USE_WXWIDGETS) INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_wxWidgets.cmake) CREA_FIND_WXWIDGETS() CREA_USE_WXWIDGETS() ENDIF(USE_WXWIDGETS) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- IF(USE_DOXYGEN) 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) ENDIF(USE_DOXYGEN) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- IF(USE_LATEX) FIND_PACKAGE(LATEX REQUIRED) MESSAGE(STATUS "Looking for latex... - found ${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 "Looking for tth... - found ${LATEX_tth_CONVERTER}") ENDIF(NOT LATEX_tth_CONVERTER) MARK_AS_ADVANCED(LATEX_tth_CONVERTER) ENDIF(USE_TTH) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- IF(USE_BOOST) FIND_PACKAGE(Boost REQUIRED) IF(Boost_FOUND) 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) ENDIF(USE_BOOST) #----------------------------------------------------------------------------- ENDMACRO(CREA_FIND_AND_USE_LIBRARIES)