1 # ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
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.
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
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 # ------------------------------------------------------------------------ */
25 # Manages the shared library creation/use
26 # * Creates an option ${LIBRARY_NAME}_BUILD_SHARED
27 # * Generates the file ${LIBRARY_NAME}_EXPORT.h which
28 # defines the symbols ${LIBRARY_NAME}_EXPORT and ${LIBRARY_NAME}_CDECL
29 # to be used in exported classes/functions declarations
30 MACRO(CREA_DYNAMIC_LIBRARY_EXPORT_OPTION LIBRARY_NAME)
32 # STATIC OR DYNAMIC (SHARED) ?
33 OPTION( ${LIBRARY_NAME}_BUILD_SHARED
34 #JPR 8 Avr 2011 ON-> OFF, to avoid troubles with unaware users
35 "Build ${LIBRARY_NAME} as a shared library ( i.e. dynamic) ?" OFF)
36 IF (${LIBRARY_NAME}_BUILD_SHARED)
37 SET(${LIBRARY_NAME}_SHARED SHARED)
38 CREA_DEFINE(${LIBRARY_NAME}_BUILD_SHARED)
39 ENDIF(${LIBRARY_NAME}_BUILD_SHARED)
41 CREA_DEFINE(${LIBRARY_NAME}_EXPORT_SYMBOLS)
43 # ADDS CURRENT BINARY DIR TO INCLUDE DIRS
44 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
46 # CONFIGURES ${LIBRARY_NAME}_EXPORT.h
48 ${CREA_CMAKE_DIR}/LIBRARY_NAME_EXPORT.h.in
49 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
52 # ADDS IT TO THE LIST OF HEADERS
53 SET(${LIBRARY_NAME}_HEADERS
54 ${${LIBRARY_NAME}_HEADERS}
55 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
59 ENDMACRO(CREA_DYNAMIC_LIBRARY_EXPORT_OPTION LIBRARY_NAME)
62 # Manages the shared library creation/use
63 # * Generates the file ${LIBRARY_NAME}_EXPORT.h which
64 # defines the symbols ${LIBRARY_NAME}_EXPORT and ${LIBRARY_NAME}_CDECL
65 # to be used in exported classes/functions declarations
66 MACRO(CREA_DYNAMIC_LIBRARY_EXPORT LIBRARY_NAME)
68 CREA_DEFINE(${LIBRARY_NAME}_BUILD_SHARED)
69 CREA_DEFINE(${LIBRARY_NAME}_EXPORT_SYMBOLS)
71 # ADDS CURRENT BINARY DIR TO INCLUDE DIRS
72 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
74 # CONFIGURES ${LIBRARY_NAME}_EXPORT.h
75 SET(LIBRARY_NAME ${LIBRARY_NAME})
77 ${CREA_CMAKE_DIR}/LIBRARY_NAME_EXPORT.h.in
78 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
81 # ADDS IT TO THE LIST OF HEADERS
82 SET(${LIBRARY_NAME}_HEADERS
83 ${${LIBRARY_NAME}_HEADERS}
84 ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_EXPORT.h
87 ENDMACRO(CREA_DYNAMIC_LIBRARY_EXPORT LIBRARY_NAME)