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