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