]> Creatis software - cpMesh.git/blob - CMakeLists.txt
231d94c2dc2ef02625034a8933bcde43fba442d9
[cpMesh.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2
3 ## ============
4 ## = Policies =
5 ## ============
6
7 SET(
8   policies
9   CMP0015
10   CMP0020
11   CMP0042
12   )
13 FOREACH(policy ${policies})
14   IF(POLICY ${policy})
15     CMAKE_POLICY(SET ${policy} NEW)
16   ENDIF(POLICY ${policy})
17 ENDFOREACH(policy)
18
19 ## ================
20 ## = Project name =
21 ## ================
22
23 PROJECT(cpMesh)
24
25 ## ===========
26 ## = Options =
27 ## ===========
28
29 OPTION(BUILD_EXAMPLES "Build demos" OFF)
30 OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
31 OPTION(BUILD_FINAL_APPLICATION "Build final application" ON)
32
33 IF(BUILD_SHARED_LIBS)
34   SET(cpm_LIBRARY_TYPE SHARED)
35 ELSE(BUILD_SHARED_LIBS)
36   SET(cpm_LIBRARY_TYPE STATIC)
37 ENDIF(BUILD_SHARED_LIBS)
38
39 ## ============
40 ## = Packages =
41 ## ============
42
43 # Prepare header to build shared libs (windows)
44 INCLUDE(GenerateExportHeader)
45
46 # Find ITK and VTK
47 FIND_PACKAGE(ITK REQUIRED)
48 FIND_PACKAGE(VTK REQUIRED)
49
50 INCLUDE(${ITK_USE_FILE})
51 INCLUDE(${VTK_USE_FILE})
52
53 # Do not use itk-vtk glue --> problems ahead!!!
54 IF(ITKVtkGlue_LOADED)
55   MESSAGE(FATAL_ERROR "ITKVtkGlue module is available. Please re-compile your ITK without it. It could lead to nasty compilation problems... Just waiting for Kitware to solve it.")
56 ENDIF(ITKVtkGlue_LOADED)
57
58 SET(QT4_FOUND "0")
59 IF(BUILD_FINAL_APPLICATION)
60   FIND_PACKAGE(Qt4 REQUIRED)
61   INCLUDE(${QT_USE_FILE})
62
63   ## Check for required vtk-qt4 modules
64   SET(
65     vtk_required_modules
66     vtkGUISupportQt
67     vtkGUISupportQtOpenGL
68     )
69   FOREACH(vtk_module ${vtk_required_modules})
70     IF(NOT ${vtk_module}_LOADED)
71       MESSAGE(
72         FATAL_ERROR
73         "${vtk_module} module is required but not available."
74         )
75       SET(QT4_FOUND "0")
76     ENDIF(NOT ${vtk_module}_LOADED)
77   ENDFOREACH(vtk_module)
78   SET(QT4_FOUND "1")
79 ENDIF(BUILD_FINAL_APPLICATION)
80
81 OPTION(USE_cpPlugins "Build cpPlugins based stuff" OFF)
82 IF(USE_cpPlugins)
83   FIND_PACKAGE(cpPlugins REQUIRED)
84 ENDIF(USE_cpPlugins)
85
86 OPTION(USE_FrontAlgorithms "Build FrontAlgorithms based stuff" OFF)
87 IF(USE_FrontAlgorithms)
88   FIND_PACKAGE(FrontAlgorithms REQUIRED)
89 ENDIF(USE_FrontAlgorithms)
90
91 ## ================================================
92 ## = Do not allow to build inside the source tree =
93 ## ================================================
94
95 IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
96   MESSAGE(FATAL_ERROR "Building in the source tree is not allowed")
97 ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
98
99 ## =====================================
100 ## = Where to put executables and libs =
101 ## =====================================
102
103 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
104 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
105 MARK_AS_ADVANCED(
106   CMAKE_BACKWARDS_COMPATIBILITY
107   EXECUTABLE_OUTPUT_PATH
108   LIBRARY_OUTPUT_PATH
109   )
110
111 ## ==============================
112 ## = Subdirs containing headers =
113 ## ==============================
114
115 INCLUDE_DIRECTORIES(
116   ${PROJECT_SOURCE_DIR}/lib
117   ${PROJECT_SOURCE_DIR}/lib/third_party
118   ${PROJECT_BINARY_DIR}/lib
119   )
120
121 ## ===========================
122 ## = Subdirs containing code =
123 ## ===========================
124
125 SUBDIRS(
126   lib
127   appli
128   )
129
130 ## eof - $RCSfile$