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)
26 MESSAGE ( STATUS "=======================================")
27 MESSAGE ( STATUS "Looking for QT4... found")
28 MESSAGE ( STATUS "* Inc Dir = ${QT_INCLUDE_DIR}")
29 MESSAGE ( STATUS "* Version = ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
30 INCLUDE(${QT_USE_FILE})
35 # MARK_AS_ADVANCED(Qt4_DIR)
39 #-----------------------------------------------------------------------------
41 #-----------------------------------------------------------------------------
43 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
44 CREA_FIND_AND_USE_VTK()
46 #-----------------------------------------------------------------------------
48 #-----------------------------------------------------------------------------
50 IF(NOT KWWidgets_FOUND)
52 FIND_PACKAGE(KWWidgets)
55 MESSAGE ( STATUS "=======================================")
56 MESSAGE ( STATUS "Looking for KWWidgets... found")
57 MESSAGE ( STATUS "* Dir = ${KWWidgets_DIR}")
58 MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
60 # KWWidgets must not search again for vtk !
61 SET(KWWidgets_NO_USE_VTK ON)
64 INCLUDE(${KWWidgets_USE_FILE})
65 CREA_DEFINE( USE_KWWIDGETS )
66 SET(KWWIDGETS_LIBRARIES
67 ${KWWidgets_LIBRARIES}
69 MARK_AS_ADVANCED(KWWidgets_DIR)
71 message(FATAL_ERROR "KWWidgets_DIR not found")
72 ENDIF(KWWidgets_FOUND)
73 ENDIF(NOT KWWidgets_FOUND)
75 #-----------------------------------------------------------------------------
79 #-----------------------------------------------------------------------------
86 MESSAGE ( STATUS "=======================================")
87 MESSAGE ( STATUS "Looking for ITK... found")
88 MESSAGE ( STATUS "* Dir = ${ITK_DIR}")
89 MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
90 SET(SKIP_ITK_BUILD_SETTINGS_FILE ON)
91 INCLUDE(${ITK_USE_FILE})
92 CREA_DEFINE( USE_ITK )
93 CREA_DEFINE( _USE_ITK_ )
95 ITKCommon ITKIO ITKBasicFilters ITKAlgorithms
97 MARK_AS_ADVANCED(ITK_DIR)
99 message(FATAL_ERROR "ITK_DIR not found")
103 #-----------------------------------------------------------------------------
106 #-----------------------------------------------------------------------------
109 MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
117 INCLUDE(${GDCM_USE_FILE})
118 CREA_DEFINE( USE_GDCM )
120 MESSAGE ( STATUS "=======================================")
121 MESSAGE ( STATUS "Looking for GDCM... found")
122 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
123 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
124 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
126 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
127 # embedded gdcm in ITK and will result in hard seg faults !
129 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
130 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
131 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
134 MARK_AS_ADVANCED(GDCM_DIR)
140 # TODO : Test that GDCM was built with option "vtkgdcm"
151 ENDIF(NOT GDCM_FOUND)
154 #-----------------------------------------------------------------------------
156 #-----------------------------------------------------------------------------
163 INCLUDE(${GDCM_USE_FILE})
165 IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
166 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")
167 ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
169 CREA_DEFINE( USE_GDCM2 )
170 CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
172 MESSAGE ( STATUS "=======================================")
173 MESSAGE ( STATUS "Looking for GDCM2... found")
174 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
175 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
176 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
178 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
179 # embedded gdcm in ITK and will result in hard seg faults !
181 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
182 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
183 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
186 MARK_AS_ADVANCED(GDCM_DIR)
192 # TODO : Test that GDCM was built with option "vtkgdcm"
203 ENDIF(NOT GDCM_FOUND)
206 #-----------------------------------------------------------------------------
208 #-----------------------------------------------------------------------------
210 IF(NOT wxWidgets_FOUND)
211 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
212 CREA_FIND_WXWIDGETS()
214 ENDIF(NOT wxWidgets_FOUND)
216 #-----------------------------------------------------------------------------
220 #-----------------------------------------------------------------------------
223 MESSAGE ( STATUS "=======================================")
224 FIND_PACKAGE(Doxygen REQUIRED)
225 # MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
229 # MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
232 #-----------------------------------------------------------------------------
235 #-----------------------------------------------------------------------------
237 IF (NOT LATEX_COMPILER)
238 FIND_PACKAGE(LATEX REQUIRED)
239 MESSAGE ( STATUS "=======================================")
240 MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
241 ENDIF (NOT LATEX_COMPILER)
243 #-----------------------------------------------------------------------------
245 #-----------------------------------------------------------------------------
247 IF (NOT TTH_EXECUTABLE)
248 FIND_FILE( TTH_EXECUTABLE NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux)
249 IF (NOT TTH_EXECUTABLE)
250 MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
251 ELSE (NOT TTH_EXECUTABLE)
252 MESSAGE ( STATUS "=======================================")
253 MESSAGE ( STATUS "Looking for tth... - found ${TTH_EXECUTABLE}")
254 ENDIF(NOT TTH_EXECUTABLE)
255 MARK_AS_ADVANCED( TTH_EXECUTABLE )
256 ENDIF(NOT TTH_EXECUTABLE)
258 #-----------------------------------------------------------------------------
261 #-----------------------------------------------------------------------------
264 FIND_PACKAGE(Boost REQUIRED)
266 MESSAGE ( STATUS "=======================================")
267 MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
268 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
269 LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} )
270 CREA_DEFINE( USE_BOOST )
287 MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
289 MESSAGE(FATAL_ERROR "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
291 ENDIF(NOT Boost_FOUND)
293 #-----------------------------------------------------------------------------
296 ENDMACRO(CREA_FIND_AND_USE_LIBRARIES)