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 #-----------------------------------------------------------------------------
24 FIND_PACKAGE(Qt4 REQUIRED)
25 INCLUDE(${QT_USE_FILE})
30 # MARK_AS_ADVANCED(Qt4_DIR)
33 #-----------------------------------------------------------------------------
35 #-----------------------------------------------------------------------------
37 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
38 CREA_FIND_AND_USE_VTK()
40 #-----------------------------------------------------------------------------
42 #-----------------------------------------------------------------------------
44 IF(NOT KWWidgets_FOUND)
46 FIND_PACKAGE(KWWidgets)
49 MESSAGE ( STATUS "=======================================")
50 MESSAGE ( STATUS "Looking for KWWidgets... found")
51 MESSAGE ( STATUS "* Dir = ${KWWidgets_DIR}")
52 MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
54 # KWWidgets must not search again for vtk !
55 SET(KWWidgets_NO_USE_VTK ON)
58 INCLUDE(${KWWidgets_USE_FILE})
59 CREA_DEFINE( USE_KWWIDGETS )
60 SET(KWWIDGETS_LIBRARIES
61 ${KWWidgets_LIBRARIES}
63 MARK_AS_ADVANCED(KWWidgets_DIR)
65 message(FATAL_ERROR "KWWidgets_DIR not found")
66 ENDIF(KWWidgets_FOUND)
67 ENDIF(NOT KWWidgets_FOUND)
69 #-----------------------------------------------------------------------------
73 #-----------------------------------------------------------------------------
80 MESSAGE ( STATUS "=======================================")
81 MESSAGE ( STATUS "Looking for ITK... found")
82 MESSAGE ( STATUS "* Dir = ${ITK_DIR}")
83 MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
84 SET(SKIP_ITK_BUILD_SETTINGS_FILE ON)
85 INCLUDE(${ITK_USE_FILE})
86 CREA_DEFINE( USE_ITK )
87 CREA_DEFINE( _USE_ITK_ )
89 ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
91 MARK_AS_ADVANCED(ITK_DIR)
93 message(FATAL_ERROR "ITK_DIR not found")
97 #-----------------------------------------------------------------------------
100 #-----------------------------------------------------------------------------
103 MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
111 INCLUDE(${GDCM_USE_FILE})
112 CREA_DEFINE( USE_GDCM )
114 MESSAGE ( STATUS "=======================================")
115 MESSAGE ( STATUS "Looking for GDCM... found")
116 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
117 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
118 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
120 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
121 # embedded gdcm in ITK and will result in hard seg faults !
123 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
124 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
125 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
128 MARK_AS_ADVANCED(GDCM_DIR)
134 # TODO : Test that GDCM was built with option "vtkgdcm"
145 ENDIF(NOT GDCM_FOUND)
148 #-----------------------------------------------------------------------------
150 #-----------------------------------------------------------------------------
157 INCLUDE(${GDCM_USE_FILE})
159 IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
160 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")
161 ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
163 CREA_DEFINE( USE_GDCM2 )
164 CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
166 MESSAGE ( STATUS "=======================================")
167 MESSAGE ( STATUS "Looking for GDCM2... found")
168 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
169 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
170 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
172 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
173 # embedded gdcm in ITK and will result in hard seg faults !
175 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
176 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
177 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
180 MARK_AS_ADVANCED(GDCM_DIR)
186 # TODO : Test that GDCM was built with option "vtkgdcm"
197 ENDIF(NOT GDCM_FOUND)
200 #-----------------------------------------------------------------------------
202 #-----------------------------------------------------------------------------
204 IF(NOT wxWidgets_FOUND)
205 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
206 CREA_FIND_WXWIDGETS()
208 ENDIF(NOT wxWidgets_FOUND)
210 #-----------------------------------------------------------------------------
214 #-----------------------------------------------------------------------------
217 MESSAGE ( STATUS "=======================================")
218 FIND_PACKAGE(Doxygen REQUIRED)
219 # MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
223 # MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
226 #-----------------------------------------------------------------------------
229 #-----------------------------------------------------------------------------
231 IF (NOT LATEX_COMPILER)
232 FIND_PACKAGE(LATEX REQUIRED)
233 MESSAGE ( STATUS "=======================================")
234 MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
235 ENDIF (NOT LATEX_COMPILER)
237 #-----------------------------------------------------------------------------
239 #-----------------------------------------------------------------------------
241 IF (NOT TTH_EXECUTABLE)
242 FIND_FILE( TTH_EXECUTABLE NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
243 IF (NOT TTH_EXECUTABLE)
244 MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
245 ELSE (NOT TTH_EXECUTABLE)
246 MESSAGE ( STATUS "=======================================")
247 MESSAGE ( STATUS "Looking for tth... - found ${TTH_EXECUTABLE}")
248 ENDIF(NOT TTH_EXECUTABLE)
249 MARK_AS_ADVANCED( TTH_EXECUTABLE )
250 ENDIF(NOT TTH_EXECUTABLE)
252 #-----------------------------------------------------------------------------
255 #-----------------------------------------------------------------------------
258 FIND_PACKAGE(Boost REQUIRED)
260 MESSAGE ( STATUS "=======================================")
261 MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
262 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
263 LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
264 CREA_DEFINE( USE_BOOST )
281 MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
283 MESSAGE(FATAL_ERROR "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
285 ENDIF(NOT Boost_FOUND)
287 #-----------------------------------------------------------------------------
290 ENDMACRO(CREA_FIND_AND_USE_LIBRARIES)