]> Creatis software - creaImageIO.git/blob - CMakeLists.txt
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / CMakeLists.txt
1 # ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
4 #                        pour la Santé)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and 
10 #  abiding by the rules of distribution of free software. You can  use, 
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
12 #  license as circulated by CEA, CNRS and INRIA at the following URL 
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability. 
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------
25
26 #
27 # Test CMake version
28 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
29
30 #MARK_AS_ADVANCED( FORCE CMAKE_BACKWARDS_COMPATIBILITY )
31 # for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
32 IF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
33   CMAKE_POLICY(SET CMP0003 NEW)
34   CMAKE_POLICY(SET CMP0005 NEW)
35   CMAKE_POLICY(SET CMP0011 NEW)
36 ENDIF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
37
38 ###################################
39 PROJECT(creaImageIO)
40 ###################################
41
42 #-----------------------------------------------------------------------------
43 # Configure Dart testing support.  This should be done before any
44 # MESSAGE(FATAL_ERROR ...) commands are invoked.
45 IF(INCLUDE_CTEST)
46   INCLUDE(CTest)
47   ENABLE_TESTING()
48 ENDIF(INCLUDE_CTEST)
49 IF(BUILD_TESTING)
50   SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard")
51   MARK_AS_ADVANCED(BUILDNAME)
52 ENDIF(BUILD_TESTING)
53 #-----------------------------------------------------------------------------
54
55 #==================================
56 # The project version
57 SET(PROJECT_MAJOR_VERSION 1)
58 SET(PROJECT_MINOR_VERSION 0)
59 SET(PROJECT_BUILD_VERSION 0)
60 SET(CREA_VERBOSE_CMAKE TRUE)
61
62 # JPR 4 mars 2011
63 set (CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Module)
64
65 #==================================
66 # Find crea (mandatory, to use macros)
67 FIND_PACKAGE(crea REQUIRED)
68 IF (crea_FOUND)
69   INCLUDE(${crea_USE_FILE})
70 ENDIF(crea_FOUND)
71 #==================================
72
73 #==================================
74 # Do not allow to build inside the source tree
75 CREA_PREVENT_IN_SOURCE_BUILD()
76 #==================================
77
78
79 # For boost 1.46 troubles...  // JPR.
80 add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
81
82 SET(USE_GDCM_VTK ON)
83
84 SET(USE_VTK ON)
85
86 SET(USE_BOOST ON)
87 OPTION(USE_WXWIDGETS "Use WxWidgets GUI" ON)
88 OPTION(USE_QT4 "USE QT4GUI"       OFF)
89 OPTION(USE_XERCES "USE Xerces if you want to use an beta version of outputModel" OFF)
90 OPTION(USE_INSTALL_APP "install only useful applications" ON)
91
92 IF(USE_QT4)
93         IF(USE_WXWIDGETS)
94                  MESSAGE(ERROR "CANNOT USE QT WXWIDGETS IN SAME TIME")
95         ENDIF(USE_WXWIDGETS)
96 ENDIF(USE_QT4)
97                  
98 IF(QT4_FOUND)
99  IF (WIN32)
100  MESSAGE("So ... ${QT_DIR}")
101                 INCLUDE_DIRECTORIES(${QT_DIR}/../include)               
102                 LINK_DIRECTORIES(${QT_DIR}/../lib)
103  ENDIF(WIN32)
104 ENDIF(QT4_FOUND)
105 #
106 # ----------------- manual setting GDCM/GDCM2 JPR
107 #                
108 OPTION(USE_GDCM "Use gdcm 1.3" ON)
109 OPTION(USE_GDCM2 "Use gdcm 2.0.14 at least" OFF)
110
111  MESSAGE(STATUS "GDCM LIB ....= ${GDCM_LIBRARIES}")
112 IF(USE_GDCM2)
113         OPTION(USE_GDCM_ANOM "use gdcm2 anonymizer tool" OFF)
114         #TO DO TEST IF GDCM_USE_SYSTEM_OPENSSL is valid
115 ENDIF(USE_GDCM2)
116 OPTION(USE_ITK "use ITK" ON)
117 CREA_FIND_AND_USE_LIBRARIES()
118
119 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
120 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
121 MARK_AS_ADVANCED(
122   CMAKE_BACKWARDS_COMPATIBILITY
123   EXECUTABLE_OUTPUT_PATH 
124   LIBRARY_OUTPUT_PATH
125   )
126
127 ##EED 04juin203
128 ##EED IF(WIN32)
129 ##EED   IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 4)
130 ##EED           INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/win32)
131 ##EED           LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/win32)
132 ##EED   endif()
133 ##EED   IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 8)
134 ##EED           INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/win64)
135 ##EED           LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/win64)
136 ##EED   endif()
137 ##EED ENDIF(WIN32)
138
139 ##EED SQLite
140 ##EED  mechanisme FIND_PACKAGE(SQLite)   missing ...
141 IF(WIN32)
142    set (SQLITE_DIR $ENV{SQLITE_DIR})
143    IF(DEFINED SQLITE_DIR)
144      INCLUDE_DIRECTORIES(${SQLITE_DIR}/include)
145      LINK_DIRECTORIES(${SQLITE_DIR}/lib)
146    ELSE()
147       MESSAGE(FATAL_ERROR  "System variable SQLITE_DIR not defined.")
148    ENDIF()
149 ENDIF(WIN32)
150
151
152 SET(LIBNAME creaImageIO)
153         INCLUDE_DIRECTORIES(
154     ${PROJECT_BINARY_DIR}
155     ${PROJECT_SOURCE_DIR}/src
156     )
157 ADD_SUBDIRECTORY(src)
158
159
160 OPTION(BUILD_CREA_BRUKER "Build creaIRM with creaBruker?" ON)
161
162 IF (BUILD_CREA_BRUKER)
163         FIND_PACKAGE(creaBruker REQUIRED)
164         IF (creaBruker_FOUND)
165                 INCLUDE(${creaBruker_USE_FILE})
166                 CREA_DEFINE(BUILD_BRUKER)
167         ENDIF(creaBruker_FOUND)
168 ENDIF (BUILD_CREA_BRUKER)
169
170
171 # To Use PACS connection library
172 OPTION(BUILD_CREA_PACS "Build creaImageIO with PACS connection library ?" OFF)
173 IF (BUILD_CREA_PACS)
174         CREA_DEFINE(BUILD_PACS)
175 ENDIF(BUILD_CREA_PACS)
176
177 #==================================
178 # Subdirs
179
180 ADD_SUBDIRECTORY(appli)
181 ADD_SUBDIRECTORY(bbtk)
182
183 #EED 31/05/2011   not compiling 
184 #ADD_SUBDIRECTORY(tests)
185
186 ##EED 04juin203
187 ##EED IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 4)
188 ##EED   ADD_SUBDIRECTORY(win32)
189 ##EED endif()
190 ##EED IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 8)
191 ##EED   ADD_SUBDIRECTORY(win64)
192 ##EED endif()
193
194 ADD_SUBDIRECTORY(install)
195 #==================================
196
197
198 #EED 31/05/2011   not compiling 
199 #ENABLE_TESTING()