Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkFunctionCreateCommandLineApp.cmake
Go to the documentation of this file.
1 #!
2 #! Create a Command Line App.
3 #!
4 #! \brief This function will create a command line executable and the scripts required to run it
5 #!
6 #! \param NAME (required) Name of the command line app
7 #! \param DEPENDS (optional) Required MITK modules beyond MitkCommandLine
8 #! \param PACKAGE_DEPENDS (optional) list of "packages" this command line app depends on (e.g. ITK, VTK, etc.)
9 #! \param CPP_FILES (optional) list of cpp files, if it is not given NAME.cpp is assumed
10 #!
11 #! Assuming that there exists a file called <code>MyApp.cpp</code>, an example call looks like:
12 #! \code
13 #! mitkFunctionCreateCommandLineApp(
14 #! NAME MyApp
15 #! DEPENDS MitkCore MitkPlanarFigure
16 #! PACKAGE_DEPENDS ITK VTK
17 #! )
18 #! \endcode
19 #!
20 
22 
23  set(_function_params
24  NAME # Name of the command line app
25  )
26 
27  set(_function_multiparams
28  DEPENDS # list of modules this command line app depends on
29  PACKAGE_DEPENDS # list of "packages" this command line app depends on (e.g. ITK, VTK, etc.)
30  CPP_FILES # (optional) list of cpp files, if it is not given NAME.cpp is assumed
31  )
32 
33  set(_function_options
34  WARNINGS_NO_ERRORS
35  )
36 
37  cmake_parse_arguments(CMDAPP "${_function_options}" "${_function_params}" "${_function_multiparams}" ${ARGN})
38 
39  if(NOT CMDAPP_NAME)
40  message(FATAL_ERROR "NAME argument cannot be empty.")
41  endif()
42 
43  if(NOT CMDAPP_CPP_FILES)
44  set(CMDAPP_CPP_FILES ${CMDAPP_NAME}.cpp)
45  endif()
46  if(CMDAPP_WARNINGS_NO_ERRORS)
47  LIST(APPEND _CMDAPP_OPTIONS WARNINGS_NO_ERRORS)
48  endif()
49  mitk_create_executable(${CMDAPP_NAME}
50  DEPENDS MitkCommandLine ${CMDAPP_DEPENDS}
51  PACKAGE_DEPENDS ${CMDAPP_PACKAGE_DEPENDS}
52  CPP_FILES ${CMDAPP_CPP_FILES}
53  ${_CMDAPP_OPTIONS}
54  )
55 endfunction()
static char * line
Definition: svm.cpp:2870
mitkFunctionCreateCommandLineApp()
This function will create a command line executable and the scripts required to run it...
const std::string NAME
mitk_create_executable()