1 ##################################################################
3 # MITK_CREATE_EXECUTABLE
5 #! Creates an executable with MITK dependencies and batch files
6 #! for proper application start-up.
11 #! MITK_CREATE_EXECUTABLE( [<exectuableName>]
12 #! [DEPENDS <modules we need>]
13 #! [PACKAGE_DEPENDS <packages we need, like ITK, VTK, QT>]
14 #! [INCLUDE_DIRS <list of additional include directories>]
15 #! [TARGET_DEPENDS <list of additional dependencies>
16 #! [WARNINGS_AS_ERRORS]
19 #! \param EXECUTABLE_NAME The name for the new executable target
20 ##################################################################
24 VERSION
# version number, e.g. "1.2.0"
25 FILES_CMAKE # file name of a
CMake file setting source list variables
26 # (defaults to files.cmake)
27 DESCRIPTION # a description
for the executable
30 set(_macro_multiparams
31 SUBPROJECTS # list of CDash labels
32 INCLUDE_DIRS # additional include dirs
33 DEPENDS # list of modules
this module depends on
34 PACKAGE_DEPENDS # list of
"packages" this module depends on (e.g. Qt, VTK, etc.)
35 TARGET_DEPENDS
# list of CMake targets this executable should depend on
36 ADDITIONAL_LIBS # list of additional libraries linked to
this executable
37 CPP_FILES # (optional) list of cpp files
41 NO_INIT #
do not create CppMicroServices initialization code
42 NO_FEATURE_INFO #
do not create a feature
info by calling add_feature_info()
43 NO_BATCH_FILE #
do not create batch files on Windows
44 WARNINGS_AS_ERRORS # treat all compiler warnings as errors
47 cmake_parse_arguments(EXEC
"${_macro_options}" "${_macro_params}" "${_macro_multiparams}" ${ARGN})
49 set(_EXEC_OPTIONS EXECUTABLE)
51 list(APPEND _EXEC_OPTIONS NO_INIT)
53 if(EXEC_WARNINGS_AS_ERRORS)
54 list(APPEND _EXEC_OPTIONS WARNINGS_AS_ERRORS)
56 if(EXEC_NO_FEATURE_INFO)
57 list(APPEND _EXEC_OPTIONS NO_FEATURE_INFO)
61 SUBPROJECTS ${EXEC_SUBPROJECTS}
62 VERSION ${EXEC_VERSION}
63 INCLUDE_DIRS ${EXEC_INCLUDE_DIRS}
64 DEPENDS ${EXEC_DEPENDS}
65 PACKAGE_DEPENDS ${EXEC_PACKAGE_DEPENDS}
66 TARGET_DEPENDS ${EXEC_TARGET_DEPENDS}
67 ADDITIONAL_LIBS ${EXEC_ADDITIONAL_LIBS}
68 FILES_CMAKE ${EXEC_FILES_CMAKE}
69 CPP_FILES ${EXEC_CPP_FILES}
70 DESCRIPTION
"${DESCRIPTION}"
74 set(EXECUTABLE_IS_ENABLED ${MODULE_IS_ENABLED})
75 set(EXECUTABLE_TARGET ${MODULE_TARGET})
77 # Add meta dependencies (e.g. on auto-load modules from depending modules)
78 if(
TARGET ${CMAKE_PROJECT_NAME}-autoload)
79 add_dependencies(${MODULE_TARGET} ${CMAKE_PROJECT_NAME}-autoload)
82 # Create batch and VS user files for Windows platforms
85 set(_batch_file_in "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_TARGET}.bat.in
")
86 if(NOT EXISTS "${_batch_file_in}
")
87 set(_batch_file_in "${MITK_CMAKE_DIR}/StartApp.bat.in
")
89 if(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
90 set(_batch_file_out_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
")
92 set(_batch_file_out_dir "${CMAKE_CURRENT_BINARY_DIR}
")
94 if(NOT EXEC_NO_BATCH_FILE)
95 foreach(BUILD_TYPE debug release)
96 mitkFunctionCreateWindowsBatchScript(
97 ${_batch_file_in} ${_batch_file_out_dir}/${MODULE_TARGET}_${BUILD_TYPE}.bat
102 mitkFunctionConfigureVisualStudioUserProjectFile(
103 NAME ${MODULE_TARGET}
mitkFunctionCreateWindowsBatchScript(in, out, build_type)
static void info(const char *fmt,...)