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 SET(SKIP_ITK_BUILD_SETTINGS_FILE ON)
71 INCLUDE(${ITK_USE_FILE})
72 CREA_DEFINE( USE_ITK )
73 CREA_DEFINE( _USE_ITK_ )
75 ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
77 MARK_AS_ADVANCED(ITK_DIR)
79 message(FATAL_ERROR "ITK_DIR not found")
83 #-----------------------------------------------------------------------------
86 #-----------------------------------------------------------------------------
89 MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
97 INCLUDE(${GDCM_USE_FILE})
98 CREA_DEFINE( USE_GDCM )
100 MESSAGE ( STATUS "=======================================")
101 MESSAGE ( STATUS "Looking for GDCM... found")
102 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
103 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
104 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
106 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
107 # embedded gdcm in ITK and will result in hard seg faults !
109 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
110 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
111 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
114 MARK_AS_ADVANCED(GDCM_DIR)
120 # TODO : Test that GDCM was built with option "vtkgdcm"
131 ENDIF(NOT GDCM_FOUND)
134 #-----------------------------------------------------------------------------
136 #-----------------------------------------------------------------------------
143 INCLUDE(${GDCM_USE_FILE})
145 IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
146 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")
147 ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
149 CREA_DEFINE( USE_GDCM2 )
150 CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
152 MESSAGE ( STATUS "=======================================")
153 MESSAGE ( STATUS "Looking for GDCM2... found")
154 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
155 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
156 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
158 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
159 # embedded gdcm in ITK and will result in hard seg faults !
161 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
162 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
163 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
166 MARK_AS_ADVANCED(GDCM_DIR)
172 # TODO : Test that GDCM was built with option "vtkgdcm"
183 ENDIF(NOT GDCM_FOUND)
186 #-----------------------------------------------------------------------------
188 #-----------------------------------------------------------------------------
190 IF(NOT wxWidgets_FOUND)
191 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
192 CREA_FIND_WXWIDGETS()
194 ENDIF(NOT wxWidgets_FOUND)
196 #-----------------------------------------------------------------------------
200 #-----------------------------------------------------------------------------
203 MESSAGE ( STATUS "=======================================")
204 FIND_PACKAGE(Doxygen REQUIRED)
205 # MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
209 # MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
212 #-----------------------------------------------------------------------------
215 #-----------------------------------------------------------------------------
217 IF (NOT LATEX_COMPILER)
218 FIND_PACKAGE(LATEX REQUIRED)
219 MESSAGE ( STATUS "=======================================")
220 MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
221 ENDIF (NOT LATEX_COMPILER)
223 #-----------------------------------------------------------------------------
225 #-----------------------------------------------------------------------------
227 IF (NOT TTH_EXECUTABLE)
228 FIND_FILE( TTH_EXECUTABLE NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
229 IF (NOT TTH_EXECUTABLE)
230 MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
231 ELSE (NOT TTH_EXECUTABLE)
232 MESSAGE ( STATUS "=======================================")
233 MESSAGE ( STATUS "Looking for tth... - found ${TTH_EXECUTABLE}")
234 ENDIF(NOT TTH_EXECUTABLE)
235 MARK_AS_ADVANCED( TTH_EXECUTABLE )
236 ENDIF(NOT TTH_EXECUTABLE)
238 #-----------------------------------------------------------------------------
240 #-----------------------------------------------------------------------------
243 FIND_PACKAGE(Boost REQUIRED)
245 MESSAGE ( STATUS "=======================================")
246 MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
247 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
248 LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
249 CREA_DEFINE( USE_BOOST )
256 MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
258 MESSAGE(FATAL_ERROR "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
260 ENDIF(NOT Boost_FOUND)
262 #-----------------------------------------------------------------------------
265 ENDMACRO(CREA_FIND_AND_USE_LIBRARIES)