]> Creatis software - creaImageIO.git/blob - CMakeLists.txt
Feature #1790
[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 # The project version
44 SET(PROJECT_MAJOR_VERSION 1)
45 SET(PROJECT_MINOR_VERSION 0)
46 SET(PROJECT_BUILD_VERSION 0)
47 SET(CREA_VERBOSE_CMAKE TRUE)
48
49 # JPR 4 mars 2011
50 set (CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Module)
51
52 #==================================
53 # Find crea (mandatory, to use macros)
54 FIND_PACKAGE(crea REQUIRED)
55 IF (crea_FOUND)
56   INCLUDE(${crea_USE_FILE})
57 ENDIF(crea_FOUND)
58 #==================================
59
60 #==================================
61 # Do not allow to build inside the source tree
62 CREA_PREVENT_IN_SOURCE_BUILD()
63 #==================================
64
65
66 # For boost 1.46 troubles...  // JPR.
67 add_definitions(-DBOOST_FILESYSTEM_VERSION=2)
68
69 SET(USE_GDCM_VTK ON)
70
71 SET(USE_VTK ON)
72
73 SET(USE_BOOST ON)
74 OPTION(USE_WXWIDGETS "Use WxWidgets GUI" ON)
75 OPTION(USE_QT4 "USE QT4GUI"       OFF)
76 OPTION(USE_XERCES "USE Xerces if you want to use an beta version of outputModel" OFF)
77 OPTION(USE_INSTALL_APP "install only useful applications" ON)
78
79 IF(USE_QT4)
80         IF(USE_WXWIDGETS)
81                  MESSAGE(ERROR "CANNOT USE QT WXWIDGETS IN SAME TIME")
82         ENDIF(USE_WXWIDGETS)
83 ENDIF(USE_QT4)
84                  
85 IF(QT4_FOUND)
86  IF (WIN32)
87  MESSAGE("So ... ${QT_DIR}")
88                 INCLUDE_DIRECTORIES(${QT_DIR}/../include)               
89                 LINK_DIRECTORIES(${QT_DIR}/../lib)
90  ENDIF(WIN32)
91 ENDIF(QT4_FOUND)
92 #
93 # ----------------- manual setting GDCM/GDCM2 JPR
94 #                
95 OPTION(USE_GDCM "Use gdcm 1.3" ON)
96 OPTION(USE_GDCM2 "Use gdcm 2.0.14 at least" OFF)
97
98  MESSAGE(STATUS "GDCM LIB ....= ${GDCM_LIBRARIES}")
99 IF(USE_GDCM2)
100         OPTION(USE_GDCM_ANOM "use gdcm2 anonymizer tool" OFF)
101         #TO DO TEST IF GDCM_USE_SYSTEM_OPENSSL is valid
102 ENDIF(USE_GDCM2)
103 OPTION(USE_ITK "use ITK" ON)
104 CREA_FIND_AND_USE_LIBRARIES()
105
106 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
107 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
108 MARK_AS_ADVANCED(
109   CMAKE_BACKWARDS_COMPATIBILITY
110   EXECUTABLE_OUTPUT_PATH 
111   LIBRARY_OUTPUT_PATH
112   )
113
114 IF(WIN32)
115         IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 4)
116                 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/win32)
117                 LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/win32)
118         endif()
119         IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 8)
120                 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/win64)
121                 LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/win64)
122         endif()
123 ENDIF(WIN32)
124
125 SET(LIBNAME creaImageIO)
126         INCLUDE_DIRECTORIES(
127     ${PROJECT_BINARY_DIR}
128     ${PROJECT_SOURCE_DIR}/src
129     )
130 ADD_SUBDIRECTORY(src)
131
132
133 OPTION(BUILD_CREA_BRUKER "Build creaIRM with creaBruker?" ON)
134
135 IF (BUILD_CREA_BRUKER)
136         FIND_PACKAGE(creaBruker REQUIRED)
137         IF (creaBruker_FOUND)
138                 INCLUDE(${creaBruker_USE_FILE})
139                 CREA_DEFINE(BUILD_BRUKER)
140         ENDIF(creaBruker_FOUND)
141 ENDIF (BUILD_CREA_BRUKER)
142
143
144 # To Use PACS connection library
145 OPTION(BUILD_CREA_PACS "Build creaImageIO with PACS connection library ?" OFF)
146 IF (BUILD_CREA_PACS)
147         CREA_DEFINE(BUILD_PACS)
148 ENDIF(BUILD_CREA_PACS)
149
150 #==================================
151 # Subdirs
152
153 ADD_SUBDIRECTORY(appli)
154 ADD_SUBDIRECTORY(bbtk)
155
156 #EED 31/05/2011   not compiling 
157 #ADD_SUBDIRECTORY(tests)
158
159 IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 4)
160         ADD_SUBDIRECTORY(win32)
161 endif()
162 IF(MSVC AND CMAKE_SIZEOF_VOID_P MATCHES 8)
163         ADD_SUBDIRECTORY(win64)
164 endif()
165
166 ADD_SUBDIRECTORY(install)
167 #==================================
168
169
170 #EED 31/05/2011   not compiling 
171 #ENABLE_TESTING()