3 MACRO(CREA_FIND_AND_USE_LIBRARIES)
5 #-----------------------------------------------------------------------------
6 # If one can invoke this macro then crea has already been found !!
7 # However if one whishes to link against crea and crea was built
8 # with wx or vtk then we have to find them.
9 # This USE_CREA var is made to resolve this dependency.
11 IF(CREA_BUILT_WITH_WX)
13 ENDIF(CREA_BUILT_WITH_WX)
14 IF(CREA_BUILT_WITH_VTK)
16 ENDIF(CREA_BUILT_WITH_VTK)
18 #-----------------------------------------------------------------------------
21 #-----------------------------------------------------------------------------
23 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
24 CREA_FIND_AND_USE_VTK()
26 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
30 IF(NOT KWWidgets_FOUND)
32 FIND_PACKAGE(KWWidgets)
35 MESSAGE ( STATUS "=======================================")
36 MESSAGE ( STATUS "Looking for KWWidgets... found")
37 MESSAGE ( STATUS "* Dir = ${KWWidgets_DIR}")
38 MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
40 # KWWidgets must not search again for vtk !
41 SET(KWWidgets_NO_USE_VTK ON)
44 INCLUDE(${KWWidgets_USE_FILE})
45 CREA_DEFINE( USE_KWWIDGETS )
46 SET(KWWIDGETS_LIBRARIES
47 ${KWWidgets_LIBRARIES}
49 MARK_AS_ADVANCED(KWWidgets_DIR)
51 message(FATAL_ERROR "KWWidgets_DIR not found")
52 ENDIF(KWWidgets_FOUND)
53 ENDIF(NOT KWWidgets_FOUND)
55 #-----------------------------------------------------------------------------
59 #-----------------------------------------------------------------------------
66 MESSAGE ( STATUS "=======================================")
67 MESSAGE ( STATUS "Looking for ITK... found")
68 MESSAGE ( STATUS "* Dir = ${ITK_DIR}")
69 MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
70 INCLUDE(${ITK_USE_FILE})
71 CREA_DEFINE( USE_ITK )
72 CREA_DEFINE( _USE_ITK_ )
74 ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
76 MARK_AS_ADVANCED(ITK_DIR)
78 message(FATAL_ERROR "ITK_DIR not found")
82 #-----------------------------------------------------------------------------
85 #-----------------------------------------------------------------------------
88 MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
96 INCLUDE(${GDCM_USE_FILE})
97 CREA_DEFINE( USE_GDCM )
99 MESSAGE ( STATUS "=======================================")
100 MESSAGE ( STATUS "Looking for GDCM... found")
101 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
102 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
103 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
105 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
106 # embedded gdcm in ITK and will result in hard seg faults !
108 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
109 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
110 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
113 MARK_AS_ADVANCED(GDCM_DIR)
119 # TODO : Test that GDCM was built with option "vtkgdcm"
130 ENDIF(NOT GDCM_FOUND)
133 #-----------------------------------------------------------------------------
135 #-----------------------------------------------------------------------------
142 INCLUDE(${GDCM_USE_FILE})
144 IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
145 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")
146 ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
148 CREA_DEFINE( USE_GDCM2 )
149 CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
151 MESSAGE ( STATUS "=======================================")
152 MESSAGE ( STATUS "Looking for GDCM2... found")
153 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
154 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
155 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
157 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
158 # embedded gdcm in ITK and will result in hard seg faults !
160 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
161 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
162 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
165 MARK_AS_ADVANCED(GDCM_DIR)
171 # TODO : Test that GDCM was built with option "vtkgdcm"
182 ENDIF(NOT GDCM_FOUND)
185 #-----------------------------------------------------------------------------
187 #-----------------------------------------------------------------------------
189 IF(NOT wxWidgets_FOUND)
190 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
191 CREA_FIND_WXWIDGETS()
193 ENDIF(NOT wxWidgets_FOUND)
195 #-----------------------------------------------------------------------------
199 #-----------------------------------------------------------------------------
202 MESSAGE ( STATUS "=======================================")
203 FIND_PACKAGE(Doxygen REQUIRED)
204 # MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
208 # MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
211 #-----------------------------------------------------------------------------
214 #-----------------------------------------------------------------------------
216 IF (NOT LATEX_COMPILER)
217 FIND_PACKAGE(LATEX REQUIRED)
218 MESSAGE ( STATUS "=======================================")
219 MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
220 ENDIF (NOT LATEX_COMPILER)
222 #-----------------------------------------------------------------------------
224 #-----------------------------------------------------------------------------
226 IF (NOT TTH_EXECUTABLE)
227 FIND_FILE( TTH_EXECUTABLE NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
228 IF (NOT TTH_EXECUTABLE)
229 MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
230 ELSE (NOT TTH_EXECUTABLE)
231 MESSAGE ( STATUS "=======================================")
232 MESSAGE ( STATUS "Looking for tth... - found ${TTH_EXECUTABLE}")
233 ENDIF(NOT TTH_EXECUTABLE)
234 MARK_AS_ADVANCED( TTH_EXECUTABLE )
235 ENDIF(NOT TTH_EXECUTABLE)
237 #-----------------------------------------------------------------------------
239 #-----------------------------------------------------------------------------
242 FIND_PACKAGE(Boost REQUIRED)
244 MESSAGE ( STATUS "=======================================")
245 MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
246 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
247 LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
248 CREA_DEFINE( USE_BOOST )
255 MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
257 MESSAGE(FATAL_ERROR "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
259 ENDIF(NOT Boost_FOUND)
261 #-----------------------------------------------------------------------------
264 ENDMACRO(CREA_FIND_AND_USE_LIBRARIES)