]> Creatis software - clitk.git/blob - CMakeLists.txt
Updates in testing
[clitk.git] / CMakeLists.txt
1 #=========================================================
2 # CLITK = Command Line ITK
3 cmake_minimum_required(VERSION 2.4)
4 cmake_policy(VERSION 2.4)
5 if(COMMAND cmake_policy)
6     cmake_policy(SET CMP0003 NEW)
7 endif(COMMAND cmake_policy)
8 PROJECT(clitk)
9 #=========================================================
10
11 #=========================================================
12 INCLUDE(cmake/common.cmake)
13 #=========================================================
14
15 #=========================================================
16 # Find ITK (required)
17 FIND_PACKAGE(ITK)
18 IF(ITK_FOUND)
19   INCLUDE("${ITK_USE_FILE}")
20 ELSE(ITK_FOUND)
21   MESSAGE(FATAL_ERROR "Cannot build without ITK.  Please set ITK_DIR.")
22 ENDIF(ITK_FOUND)
23 #=========================================================
24
25 #=========================================================
26 # Find VTK (required)
27 FIND_PACKAGE(VTK REQUIRED)
28 IF(VTK_FOUND)
29   INCLUDE("${VTK_USE_FILE}")
30 ELSE(VTK_FOUND)
31   MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
32 ENDIF(VTK_FOUND)
33 #=========================================================
34
35 #=========================================================
36 # Find gengetopt
37 FIND_PATH(CLITK_GENGETOPT gengetopt)
38 IF (CLITK_GENGETOPT STREQUAL "CLITK_GENGETOPT-NOTFOUND")
39   MESSAGE("gengetopt not found, please install it (see http://www.gnu.org/software/gengetopt/gengetopt.html)")
40 ENDIF (CLITK_GENGETOPT STREQUAL "CLITK_GENGETOPT-NOTFOUND")
41 #=========================================================
42
43 #=========================================================
44 # Find libstatgrab is installed, add clitkMemoryUsage.cxx in the library
45 FIND_LIBRARY(LIBSTATGRAB NAMES statgrab PATHS)
46 IF (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
47 #  MESSAGE("Install libstatgrab (http://www.i-scream.org/libstatgrab/) for memory usage information")
48   SET(CLITK_MEMORY_INFO OFF)
49 ELSE (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
50   SET(CLITK_MEMORY_INFO ON)
51 ENDIF (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")  
52 #=========================================================
53
54 #=========================================================
55 # If the user choose to build documentation, then search for Doxygen executables.
56 OPTION(BUILD_DOXYGEN "Build Doxygen Documentation" OFF)
57 IF(BUILD_DOXYGEN)
58   FIND_PACKAGE(Doxygen)
59   ADD_SUBDIRECTORY(Doxygen)
60 ENDIF(BUILD_DOXYGEN)
61 #=========================================================
62
63 #=========================================================
64 # Building in the source tree is forbidden
65 IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
66   MESSAGE(FATAL_ERROR "Building in the source tree is not allowed ! Quit; remove the file 'CMakeCache.txt' and the folder 'CMakeFiles' an
67 d build outside the sources (for example 'mkdir build ; cmake <CLITK_DIR>'.")
68 ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
69 #=========================================================
70
71 #=========================================================
72 # Remove some MS Visual c++ flags
73 IF(MSVC)
74   ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
75 ENDIF(MSVC)
76 #=========================================================
77
78 #=========================================================
79 INCLUDE_DIRECTORIES(itk filters segmentation registration tools ${PROJECT_BINARY_DIR})
80
81 # Select what is compiled
82 ADD_SUBDIRECTORY(common)
83 add_subdirectory(tools)
84 add_subdirectory(segmentation)
85 add_subdirectory(registration)
86
87
88 # Compilation options
89 OPTION(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
90 OPTION(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
91 OPTION(CLITK_BUILD_SEGMENTATION "Build command-line segmentation tools" OFF)
92 OPTION(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
93
94 OPTION(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
95 IF (CLITK_BUILD_VV)
96   ADD_SUBDIRECTORY(vv)
97 ENDIF(CLITK_BUILD_VV)
98
99
100 #=========================================================
101 #Support for the CTest dashboard testing system
102 OPTION(CLITK_BUILD_TESTING "Build the testing tree" OFF)
103 #=========================================================
104 IF (CLITK_BUILD_TESTING)
105   ENABLE_TESTING()
106   ADD_SUBDIRECTORY(tests)
107 ENDIF(CLITK_BUILD_TESTING)
108 #=========================================================
109
110
111 #=========================================================
112