3 MACRO(CREA_FIND_AND_USE_LIBRARIES)
10 set(USE_DEBUG_LIB "" CACHE BOOL "Use Debug Libraries" )
12 #-----------------------------------------------------------------------------
13 # If one can invoke this macro then crea has already been found !!
14 # However if one whishes to link against crea and crea was built
15 # with wx or vtk then we have to find them.
16 # This USE_CREA var is made to resolve this dependency.
18 IF(CREA_BUILT_WITH_WX)
20 ENDIF(CREA_BUILT_WITH_WX)
21 IF(CREA_BUILT_WITH_VTK)
23 ENDIF(CREA_BUILT_WITH_VTK)
25 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
32 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseQt.cmake)
33 #FIND_PACKAGE(Qt4 REQUIRED)
36 MESSAGE ( STATUS "=======================================")
37 MESSAGE ( STATUS "Looking for QT4... found")
38 MESSAGE ( STATUS "* Inc Dir = ${QT_INCLUDE_DIR}")
39 MESSAGE ( STATUS "* Version = ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
40 INCLUDE(${QT_USE_FILE})
46 # MARK_AS_ADVANCED(Qt4_DIR)
50 #-----------------------------------------------------------------------------
52 #-----------------------------------------------------------------------------
54 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
55 CREA_FIND_AND_USE_VTK()
57 #-----------------------------------------------------------------------------
59 #-----------------------------------------------------------------------------
61 IF(NOT KWWidgets_FOUND)
63 FIND_PACKAGE(KWWidgets)
66 MESSAGE ( STATUS "=======================================")
67 MESSAGE ( STATUS "Looking for KWWidgets... found")
68 MESSAGE ( STATUS "* Dir = ${KWWidgets_DIR}")
69 MESSAGE ( STATUS "* Version = ${KWWidgets_MAJOR_VERSION}.${KWWidgets_MINOR_VERSION}.${KWWidgets_BUILD_VERSION}")
71 # KWWidgets must not search again for vtk !
72 SET(KWWidgets_NO_USE_VTK ON)
75 INCLUDE(${KWWidgets_USE_FILE})
76 CREA_DEFINE( USE_KWWIDGETS )
77 SET(KWWIDGETS_LIBRARIES
78 ${KWWidgets_LIBRARIES}
80 MARK_AS_ADVANCED(KWWidgets_DIR)
82 message(FATAL_ERROR "KWWidgets_DIR not found")
83 ENDIF(KWWidgets_FOUND)
84 ENDIF(NOT KWWidgets_FOUND)
86 #-----------------------------------------------------------------------------
89 # Always let ITK *BEFORE* GDCM
90 # It allows to use 'system installed gdcm' instead of 'itk embedded gdcm'
93 #-----------------------------------------------------------------------------
100 MESSAGE ( STATUS "=======================================")
101 MESSAGE ( STATUS "Looking for ITK... found")
102 MESSAGE ( STATUS "* Dir = ${ITK_DIR}")
103 MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
104 SET(SKIP_ITK_BUILD_SETTINGS_FILE ON)
105 INCLUDE(${ITK_USE_FILE})
106 CREA_DEFINE( USE_ITK )
107 CREA_DEFINE( _USE_ITK_ )
108 If (${ITK_VERSION_MAJOR} MATCHES "4")
109 MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}")
112 MESSAGE ( STATUS "${ITK_LIBRARIES}")
115 ITKCommon ITKIO ITKBasicFilters ITKAlgorithms)
117 MARK_AS_ADVANCED(ITK_DIR)
119 message(FATAL_ERROR "ITK_DIR not found")
123 #-----------------------------------------------------------------------------
126 #-----------------------------------------------------------------------------
130 MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
138 INCLUDE(${GDCM_USE_FILE})
139 CREA_DEFINE( USE_GDCM )
141 MESSAGE ( STATUS "=======================================")
142 MESSAGE ( STATUS "Looking for GDCM... found")
143 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
144 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
145 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
147 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
148 # embedded gdcm in ITK and will result in hard seg faults !
150 IF (GDCM_NAME_SPACE STREQUAL "gdcm")
151 MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
152 ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
155 MARK_AS_ADVANCED(GDCM_DIR)
161 # TODO : Test that GDCM was built with option "vtkgdcm"
172 MESSAGE(FATAL_ERROR "GDCM not found....")
175 ENDIF(NOT GDCM_FOUND)
178 #-----------------------------------------------------------------------------
182 MESSAGE(ERROR "CANNOT USE BOTH gdcm AND gdcm2 !")
185 # IF(NOT USE_ITK) # JPR : ITK vs GDCM (avoid cmake break)
188 FIND_PACKAGE(GDCM REQUIRED)
189 INCLUDE(${GDCM_USE_FILE})
191 IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
192 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")
193 ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
195 CREA_DEFINE( USE_GDCM2 )
196 MARK_AS_ADVANCED(GDCM_DIR)
197 CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
199 MESSAGE ( STATUS "=======================================")
200 MESSAGE ( STATUS "Looking for GDCM2... found")
201 MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
202 MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
203 MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
205 # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
206 # embedded gdcm in ITK and will result in hard seg faults !
207 INCLUDE_DIRECTORIES(${GDCM_INCLUDE_DIRS})
208 LINK_DIRECTORIES( ${GDCM_LIBRARY_DIRS})
245 # ENDIF(NOT USE_ITK) # JPR : ITK vs GDCM (avoid cmake break)
249 #-----------------------------------------------------------------------------
251 #-----------------------------------------------------------------------------
253 #-----------------------------------------------------------------------------
255 IF(NOT wxWidgets_FOUND)
256 INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseWxWidgets.cmake)
257 CREA_FIND_WXWIDGETS(${USE_DEBUG_LIB})
259 ENDIF(NOT wxWidgets_FOUND)
261 #-----------------------------------------------------------------------------
265 #-----------------------------------------------------------------------------
268 MESSAGE ( STATUS "=======================================")
269 FIND_PACKAGE(Doxygen REQUIRED)
270 # MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN}")
274 # MESSAGE(FATAL_ERROR "Doxygen not found. Required to build the doxygen documentation")
277 #-----------------------------------------------------------------------------
280 #-----------------------------------------------------------------------------
282 IF (NOT LATEX_COMPILER)
283 FIND_PACKAGE(LATEX REQUIRED)
284 MESSAGE ( STATUS "=======================================")
285 MESSAGE(STATUS "Looking for latex... - found ${LATEX_COMPILER}")
287 MESSAGE(FATAL_ERROR "LATEX_COMPILER NOT FOUND. Example:latex (MacOS:/opt/local/bin/latex)")
288 ENDIF (NOT LATEX_FOUND)
289 ENDIF (NOT LATEX_COMPILER)
292 #-----------------------------------------------------------------------------
294 #-----------------------------------------------------------------------------
296 IF (NOT TTH_EXECUTABLE)
297 FIND_FILE( TTH_EXECUTABLE NAME tth tth.exe PATHS . $ENV{CREATIS}/tth_exe/ ~/Creatis/tth ~/Creatis/tth_linux $ENV{TTH})
299 IF (NOT TTH_EXECUTABLE)
300 MESSAGE(FATAL_ERROR "TTH not found (LATEX_tth_CONVERTER). Required to build the HTML documentation from tex source")
301 ELSE (NOT TTH_EXECUTABLE)
302 MESSAGE ( STATUS "=======================================")
303 MESSAGE ( STATUS "Looking for tth... - found ${TTH_EXECUTABLE}")
304 ENDIF(NOT TTH_EXECUTABLE)
305 MARK_AS_ADVANCED( TTH_EXECUTABLE )
306 ENDIF(NOT TTH_EXECUTABLE)
308 #-----------------------------------------------------------------------------
309 #-----------------------------------------------------------------------------
312 add_definitions( -DBOOST_ALL_NO_LIB )
313 add_definitions( -DBOOST_ALL_DYN_LINK )
314 FIND_PACKAGE(Boost COMPONENTS filesystem system signals date_time regex REQUIRED)
316 ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=3)
317 MESSAGE ( STATUS "=======================================")
318 MESSAGE ( STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIR}")
319 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
320 LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS})
322 CREA_DEFINE( USE_BOOST )
323 ADD_DEFINITIONS(-DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
328 # FCY with cmake boost, it's useless.
329 # But if it is not working, uncomment
332 # SET(BOOST_LIBRARIES
333 # boost_signals-vc90-mt-gd-1_40
334 # boost_filesystem-vc90-mt-gd-1_40
335 # boost_date_time-vc90-mt-gd-1_40
336 # #what about boost_thread? JPR
338 # ELSE(NOT USE_DEBUG_LIB)
339 # SET(BOOST_LIBRARIES
340 # boost_signals-vc90-mt-1_40
341 # boost_filesystem-vc90-mt-1_40
342 # boost_date_time-vc90-mt-1_40
344 # ENDIF(USE_DEBUG_LIB)
353 boost_program_options-mt
356 #EED boost_signals-mt
357 #EED boost_filesystem-mt
358 #EED boost_date_time-mt
360 #EED boost_program_options-mt
367 MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
368 MARK_AS_ADVANCED(Boost_LIBRARY_DIRS)
371 MESSAGE( STATUS "boost C++ library not found - Set Boost_INCLUDE_DIR to the directory containing boost headers")
373 ENDIF(NOT Boost_FOUND)
377 #-----------------------------------------------------------
384 SET(XERCES_LIB_DIR $ENV{XERCES_DIR})
386 IF(NOT XERCES_LIB_DIR)
387 MESSAGE(FATAL_ERROR "XERCES_DIR not found")
388 ELSE(NOT XERCES_LIB_DIR)
390 INCLUDE_DIRECTORIES( ${XERCES_LIB_DIR}/include )
391 LINK_DIRECTORIES( ${XERCES_LIB_DIR}/lib )
393 ENDIF(NOT XERCES_LIB_DIR)
396 set(XERCES_LIBRARIES xerces-c_3D)
398 set(XERCES_LIBRARIES xerces-c_3)
401 MARK_AS_ADVANCED(XERCES_LIB_DIR)
407 SET(XERCES_LIBRARIES xerces-c )
408 INCLUDE_DIRECTORIES( /opt/local/include )
409 LINK_DIRECTORIES( /opt/local/lib )
412 SET(XERCES_LIBRARIES xerces-c )
413 INCLUDE_DIRECTORIES( /usr/local/include )
414 LINK_DIRECTORIES( /usr/local/lib /usr/lib)
415 #FIND_PACKAGE(Xerces)
418 # INCLUDE_DIRECTORIES( ${XERCES_INCLUDE_DIR} )
426 ENDMACRO(CREA_FIND_AND_USE_LIBRARIES)