]> Creatis software - FrontAlgorithms.git/blob - CMakeLists.txt
...
[FrontAlgorithms.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(FrontAlgorithms)
24 SET(FrontAlgorithms_MAJOR_VERSION   "0")
25 SET(FrontAlgorithms_MINOR_VERSION   "0")
26 SET(FrontAlgorithms_RELEASE_VERSION "1")
27 SET(FrontAlgorithms_VERSION "${FrontAlgorithms_MAJOR_VERSION}.${FrontAlgorithms_MINOR_VERSION}.${FrontAlgorithms_RELEASE_VERSION}")
28
29 ## ===========
30 ## = Options =
31 ## ===========
32
33 OPTION(BUILD_EXAMPLES "Build examples" OFF)
34 OPTION(BUILD_SHARED_LIBS "Build shared libs" OFF)
35
36 IF(BUILD_SHARED_LIBS)
37   SET(LIB_TYPE SHARED)
38 ELSE(BUILD_SHARED_LIBS)
39   SET(LIB_TYPE STATIC)
40 ENDIF(BUILD_SHARED_LIBS)
41
42 ## ============
43 ## = Packages =
44 ## ============
45
46 # Prepare header to build shared libs (windows)
47 INCLUDE(GenerateExportHeader)
48
49 # Find ITK and VTK
50 FIND_PACKAGE(ITK REQUIRED)
51 FIND_PACKAGE(VTK REQUIRED)
52
53 INCLUDE(${ITK_USE_FILE})
54 INCLUDE(${VTK_USE_FILE})
55
56 # Do not use itk-vtk glue --> problems ahead!!!
57 IF(ITKVtkGlue_LOADED)
58   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.")
59 ENDIF(ITKVtkGlue_LOADED)
60
61 OPTION(USE_cpPlugins "Build cpPlugins based stuff" OFF)
62 IF(USE_cpPlugins)
63   FIND_PACKAGE(cpPlugins REQUIRED)
64 ENDIF(USE_cpPlugins)
65
66 ## ================================================
67 ## = Do not allow to build inside the source tree =
68 ## ================================================
69
70 IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
71   MESSAGE(FATAL_ERROR "Building in the source tree is not allowed")
72 ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
73
74 ## =====================================
75 ## = Where to put executables and libs =
76 ## =====================================
77
78 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
79 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
80 MARK_AS_ADVANCED(
81   CMAKE_BACKWARDS_COMPATIBILITY
82   EXECUTABLE_OUTPUT_PATH
83   LIBRARY_OUTPUT_PATH
84   )
85
86 ## ==============================
87 ## = Subdirs containing headers =
88 ## ==============================
89
90 INCLUDE_DIRECTORIES(
91   ${PROJECT_SOURCE_DIR}/lib
92   ${PROJECT_BINARY_DIR}/lib
93   )
94
95 ## ===========================
96 ## = Subdirs containing code =
97 ## ===========================
98
99 SUBDIRS(
100   cmake
101   lib
102   appli
103   )
104
105 ## eof - $RCSfile$