]> Creatis software - crea.git/blob - cmake/CREAMacro_Define.cmake
88b0a84bdc231ad5bdb42e508d307d4825254fca
[crea.git] / cmake / CREAMacro_Define.cmake
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 #
7 #  This software is governed by the CeCILL-B license under French law and 
8 #  abiding by the rules of distribution of free software. You can  use, 
9 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
10 #  license as circulated by CEA, CNRS and INRIA at the following URL 
11 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
12 #  or in the file LICENSE.txt.
13 #
14 #  As a counterpart to the access to the source code and  rights to copy,
15 #  modify and redistribute granted by the license, users are provided only
16 #  with a limited warranty  and the software's author,  the holder of the
17 #  economic rights,  and the successive licensors  have only  limited
18 #  liability. 
19 #
20 #  The fact that you are presently reading this means that you have had
21 #  knowledge of the CeCILL-B license and that you accept its terms.
22 # ------------------------------------------------------------------------ */ 
23
24
25 #-----------------------------------------------------------------------------
26 # MACRO TO ADD A COMPILER DEFINITION WHICH ADDS ALSO THE DEF 
27 # INTO DOXYGEN PREDEFINED VAR 
28 # (OTHERWISE DOXYGEN WOULD NOT PARSE THE FILES BLOCKED)
29 MACRO(CREA_DEFINE DEF)
30   MESSAGE(STATUS "* Added definition -D${DEF}")
31   ADD_DEFINITIONS( -D${DEF} )
32   SET(CREA_DEFINITIONS
33     ${CREA_DEFINITIONS};${DEF}
34     CACHE 
35     STRING 
36     ""
37     FORCE)
38   MARK_AS_ADVANCED(CREA_DEFINITIONS)
39 ENDMACRO(CREA_DEFINE)
40 #-----------------------------------------------------------------------------
41
42 #-----------------------------------------------------------------------------
43 # MACRO TO ADD A COMPILER DEFINITION WITH VALUE WHICH ADDS ALSO THE DEF 
44 # INTO DOXYGEN PREDEFINED VAR 
45 # (OTHERWISE DOXYGEN WOULD NOT PARSE THE FILES BLOCKED)
46 MACRO(CREA_DEFINE_WITH_VAL DEF VAL)
47   MESSAGE(STATUS "* Added definition -D${DEF}=${VAL}")
48   ADD_DEFINITIONS( -D${DEF}=${VAL} )
49   SET(CREA_DEFINITIONS
50     ${CREA_DEFINITIONS};${DEF}=${VAL}
51     CACHE 
52     STRING 
53     ""
54     FORCE)
55   MARK_AS_ADVANCED(CREA_DEFINITIONS)
56 ENDMACRO(CREA_DEFINE_WITH_VAL)
57 #-----------------------------------------------------------------------------
58
59 #-----------------------------------------------------------------------------
60 MACRO(CREA_DEFINE_OPERATING_SYSTEM )
61   IF(APPLE)
62    CREA_DEFINE(MACOSX)
63   ELSE(APPLE)
64     IF("${CMAKE_SYSTEM}" MATCHES "Linux")
65       CREA_DEFINE(LINUX)
66     ELSE("${CMAKE_SYSTEM}" MATCHES "Linux")
67       IF(WIN32)
68         CREA_DEFINE(WIN32)
69       ELSE(WIN32)
70         MESSAGE(FATAL_ERROR "${CMAKE_SYSTEM} unsupported ! Build at your own risks ! (remove this line from kernel/cmake/BBTKAddDefinitions.cmake)")
71       ENDIF(WIN32)
72     ENDIF("${CMAKE_SYSTEM}" MATCHES "Linux")
73   ENDIF(APPLE) 
74
75
76   IF (WIN32)
77     SET(CMAKE_CREA_LIB_PATH bin)
78   ELSE (WIN32)
79     if( NOT APPLE )
80       # check 64 bit
81       if( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
82          set( HAVE_64_BIT 0 )
83          SET(CMAKE_CREA_LIB_PATH lib/creatools)
84       else( ${CMAKE_SIZEOF_VOID_P}EQUAL 4 )
85          set( HAVE_64_BIT 1 )
86          SET(CMAKE_CREA_LIB_PATH lib64/creatools)
87       endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
88     else ( NOT APPLE )
89          SET(CMAKE_CREA_LIB_PATH lib/creatools)
90
91       if( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
92          message("EED crea definitions  --------APPLE------------ 64 0")
93       else( ${CMAKE_SIZEOF_VOID_P}EQUAL 4 )
94          message("EED crea definitions  --------APPLE------------ 64 1")
95       endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
96
97
98     endif( NOT APPLE )
99   ENDIF(WIN32)
100
101
102 ENDMACRO(CREA_DEFINE_OPERATING_SYSTEM)
103 #-----------------------------------------------------------------------------
104