]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseVTK.cmake
aee215f303e7083a1263a18f169b6aafbdc3c99a
[crea.git] / cmake / CREAMacro_FindAndUseVTK.cmake
1 MACRO(CREA_FIND_AND_USE_VTK)
2   #---------------------------------------------------------------------------
3   IF(NOT VTK_FOUND)
4     # Search VTK
5         message("DFCH--VTK: CREAMacro_FindAndUseVTK.cmake: "${CMAKE_CURRENT_LIST_FILE})
6         message("DFCH--VTK: CREAMacro_FindAndUseVTK.cmake: "${_IMPORT_PREFIX})
7     FIND_PACKAGE(VTK)
8     # If vtk found
9     IF(VTK_FOUND)
10
11       MESSAGE ( STATUS "=======================================")
12       MESSAGE ( STATUS "Looking for VTK... found")
13       MESSAGE ( STATUS "* Dir     = ${VTK_DIR}")
14       MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
15       SET(VTK_BUILD_SETTINGS_FILE OFF)      
16         INCLUDE(${VTK_USE_FILE})
17         LINK_DIRECTORIES(${VTK_DIR}) #DFCH -- 16/7/2012
18
19         IF(VTK_USE_GL2PS)
20                 add_definitions(-DUSE_WXGLCANVAS)
21                 # CMake 2.6:
22                 # technically those packages are not required since one can still use the Motif/X11 version and not the gtk one:
23                 FIND_PACKAGE(PkgConfig)
24                 pkg_check_modules (GTK2 gtk+-2.0)
25                 #MESSAGE("${GTK2_INCLUDE_DIRS}")
26                 INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
27                 LINK_LIBRARIES(${GTK2_LIBRARIES})
28                 # Can I require all my user to have the gl lib on linux, even if they do not really need it...
29                 SET(WXGLCANVASLIBS "gl")
30         ENDIF(VTK_USE_GL2PS)  
31
32       CREA_DEFINE( USE_VTK )
33       CREA_DEFINE( _USE_VTK_ )
34       SET(VTK_LIBRARIES
35         vtkCommon     # Mandatory
36         vtkFiltering  # vtkImageData
37         vtkRendering  # vtkProp3D
38         vtkWidgets    # vtkImagePlaneWidget
39         vtkIO         # vtkMetaImageReader/Writer
40         vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
41         vtkGraphics   # vtkContourFilter, sources
42         vtkVolumeRendering # Mappers 
43         vtkGenericFiltering
44         vtkHybrid
45 #       vtkInfovis
46 #       vtkViews
47         )
48       IF(NOT USE_ITK)
49         SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
50       ENDIF(NOT USE_ITK)
51       MARK_AS_ADVANCED(VTK_DIR)
52     ELSE(VTK_FOUND)
53       message(FATAL_ERROR "VTK_DIR not found")
54     ENDIF(VTK_FOUND)
55   ENDIF(NOT VTK_FOUND)  
56   #---------------------------------------------------------------------------
57 ENDMACRO(CREA_FIND_AND_USE_VTK)