1 #Generates the cmake commands to build and install the executable EXE_NAME.
2 # ${EXE_NAME}_SOURCES must contain the list of files to compile
3 # to build the executable.
4 # ${EXE_NAME}_LINK_LIBRARIES must contain the list of libraries to link with
7 # if ${EXE_NAME}_HAS_GUI is set to TRUE then a Win32 application is generated
8 # if ${EXE_NAME}_CONSOLE is set to TRUE then the application will have a console attached.
9 MACRO(CREA_ADD_EXECUTABLE EXE_NAME)
11 IF(CREA_VERBOSE_CMAKE)
12 MESSAGE(STATUS "===============================================")
13 MESSAGE(STATUS "Configuring executable ${EXE_NAME}")
14 MESSAGE(STATUS " Sources : ${${EXE_NAME}_SOURCES}")
15 MESSAGE(STATUS " Link libs: ${${EXE_NAME}_LINK_LIBRARIES}")
17 MESSAGE(STATUS " Win32 app: ${${EXE_NAME}_HAS_GUI}")
18 MESSAGE(STATUS " Console : ${${EXE_NAME}_CONSOLE}")
20 MESSAGE(STATUS "===============================================")
21 ENDIF(CREA_VERBOSE_CMAKE)
23 IF(WIN32 AND ${EXE_NAME}_HAS_GUI )
24 ADD_EXECUTABLE(${EXE_NAME} WIN32 ${${EXE_NAME}_SOURCES})
25 IF( ${${EXE_NAME}_CONSOLE} )
26 SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES LINK_FLAGS /subsystem:console )
27 ENDIF( ${${EXE_NAME}_CONSOLE} )
28 ELSE(WIN32 AND ${EXE_NAME}_HAS_GUI )
29 IF(${EXE_NAME}_HAS_GUI AND APPLE)
30 ADD_EXECUTABLE(${EXE_NAME} MACOSX_BUNDLE ${${EXE_NAME}_SOURCES})
31 ELSE(${EXE_NAME}_HAS_GUI AND APPLE)
32 ADD_EXECUTABLE(${EXE_NAME} ${${EXE_NAME}_SOURCES})
33 ENDIF(${EXE_NAME}_HAS_GUI AND APPLE)
34 ENDIF(WIN32 AND ${EXE_NAME}_HAS_GUI )
36 TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXE_NAME}_LINK_LIBRARIES})
38 INSTALL_TARGETS(/bin/ ${EXE_NAME})
40 ENDMACRO(CREA_ADD_EXECUTABLE)