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 #Generates the cmake commands to build and install the executable EXE_NAME.
28 # ${EXE_NAME}_SOURCES must contain the list of files to compile
29 # to build the executable.
30 # ${EXE_NAME}_LINK_LIBRARIES must contain the list of libraries to link with
33 # if ${EXE_NAME}_HAS_GUI is set to TRUE then a Win32 application is generated
34 # if ${EXE_NAME}_CONSOLE is set to TRUE then the application will have a console attached.
35 MACRO(CREA_ADD_EXECUTABLE EXE_NAME)
37 IF(CREA_VERBOSE_CMAKE)
38 MESSAGE(STATUS "===============================================")
39 MESSAGE(STATUS "Configuring executable ${EXE_NAME}")
40 MESSAGE(STATUS " Sources : ${${EXE_NAME}_SOURCES}")
41 MESSAGE(STATUS " Link libs: ${${EXE_NAME}_LINK_LIBRARIES}")
43 MESSAGE(STATUS " Win32 app: ${${EXE_NAME}_HAS_GUI}")
44 MESSAGE(STATUS " Console : ${${EXE_NAME}_CONSOLE}")
46 MESSAGE(STATUS "===============================================")
47 ENDIF(CREA_VERBOSE_CMAKE)
49 IF(WIN32 AND ${EXE_NAME}_HAS_GUI )
50 ADD_EXECUTABLE(${EXE_NAME} WIN32 ${${EXE_NAME}_SOURCES})
51 IF( ${${EXE_NAME}_CONSOLE} )
52 SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES LINK_FLAGS /subsystem:console )
53 ENDIF( ${${EXE_NAME}_CONSOLE} )
54 ELSE(WIN32 AND ${EXE_NAME}_HAS_GUI )
55 IF(${EXE_NAME}_HAS_GUI AND APPLE)
56 ADD_EXECUTABLE(${EXE_NAME} MACOSX_BUNDLE ${${EXE_NAME}_SOURCES})
57 ELSE(${EXE_NAME}_HAS_GUI AND APPLE)
58 ADD_EXECUTABLE(${EXE_NAME} ${${EXE_NAME}_SOURCES})
59 ENDIF(${EXE_NAME}_HAS_GUI AND APPLE)
60 ENDIF(WIN32 AND ${EXE_NAME}_HAS_GUI )
62 TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXE_NAME}_LINK_LIBRARIES})
64 INSTALL_TARGETS(/bin/ ${EXE_NAME})
66 ENDMACRO(CREA_ADD_EXECUTABLE)