1 # ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 # Manages the shared library creation/use
28 # * Creates an option ${LIBRARY_NAME}_BUILD_SHARED
29 # * Generates the file ${LIBRARY_NAME}_EXPORT.h which
30 # defines the symbols ${LIBRARY_NAME}_EXPORT and ${LIBRARY_NAME}_CDECL
31 # to be used in exported classes/functions declarations
32 MACRO(CREA_DYNAMIC_LIBRARY_EXPORT_OPTION LIBRARY_NAME)
34 # STATIC OR DYNAMIC (SHARED) ?
35 OPTION( ${LIBRARY_NAME}_BUILD_SHARED
36 #JPR 8 Avr 2011 ON-> OFF, to avoid troubles with unaware users
37 "Build ${LIBRARY_NAME} as a shared library ( i.e. dynamic) ?" OFF)
38 IF (${LIBRARY_NAME}_BUILD_SHARED)
39 SET(${LIBRARY_NAME}_SHARED SHARED)
40 CREA_DEFINE(${LIBRARY_NAME}_BUILD_SHARED)
41 ENDIF(${LIBRARY_NAME}_BUILD_SHARED)
43 CREA_DEFINE(${LIBRARY_NAME}_EXPORT_SYMBOLS)
45 # ADDS CURRENT BINARY DIR TO INCLUDE DIRS
46 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
48 # CONFIGURES ${LIBRARY_NAME}_EXPORT.h
50 ${CREA_CMAKE_DIR}/LIBRARY_NAME_EXPORT.h.in
51 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
54 # ADDS IT TO THE LIST OF HEADERS
55 SET(${LIBRARY_NAME}_HEADERS
56 ${${LIBRARY_NAME}_HEADERS}
57 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
61 ENDMACRO(CREA_DYNAMIC_LIBRARY_EXPORT_OPTION LIBRARY_NAME)
64 # Manages the shared library creation/use
65 # * Generates the file ${LIBRARY_NAME}_EXPORT.h which
66 # defines the symbols ${LIBRARY_NAME}_EXPORT and ${LIBRARY_NAME}_CDECL
67 # to be used in exported classes/functions declarations
68 MACRO(CREA_DYNAMIC_LIBRARY_EXPORT LIBRARY_NAME)
70 CREA_DEFINE(${LIBRARY_NAME}_BUILD_SHARED)
71 CREA_DEFINE(${LIBRARY_NAME}_EXPORT_SYMBOLS)
73 # ADDS CURRENT BINARY DIR TO INCLUDE DIRS
74 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
76 # CONFIGURES ${LIBRARY_NAME}_EXPORT.h
77 SET(LIBRARY_NAME ${LIBRARY_NAME})
79 ${CREA_CMAKE_DIR}/LIBRARY_NAME_EXPORT.h.in
80 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
83 # ADDS IT TO THE LIST OF HEADERS
84 SET(${LIBRARY_NAME}_HEADERS
85 ${${LIBRARY_NAME}_HEADERS}
86 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
89 ENDMACRO(CREA_DYNAMIC_LIBRARY_EXPORT LIBRARY_NAME)