2 #! \brief Download and compile a CMake doxygen input filter
4 #! \param OUT <out-file> (optional) Supply an absolute filename for
5 #! the generated executable.
6 #! \param NAMESPACE <namespace> (optional) Supply a C++ namespace in
7 #! which the generated function declrarations
10 #! \return This function sets the <code>CMakeDoxygenFilter_EXECUTABLE</code>
11 #! variable to the absolute path of the generated input filter executable
12 #! in the parent scope. If <out-file> is specified, they will be the same.
14 #! This CMake function compiles the http://github.com/saschazelzer/CMakeDoxygenFilter
15 #! project into a doxygen input filter executable. See
16 #! http://github.com/saschazelzer/CMakeDoxygenFilter/blob/master/README for more details.
20 #-------------------- parse
function arguments -------------------
24 set(arg_names "OUT;NAMESPACE")
27 foreach(arg_name ${arg_names})
28 set(${prefix}_${arg_name})
31 foreach(option ${option_names})
32 set(${prefix}_${option} FALSE)
35 set(current_arg_name DEFAULT_ARGS)
39 set(larg_names ${arg_names})
40 list(FIND larg_names
"${arg}" is_arg_name)
41 if(is_arg_name GREATER -1)
42 set(${prefix}_${current_arg_name} ${current_arg_list})
43 set(current_arg_name
"${arg}")
45 else(is_arg_name GREATER -1)
46 set(loption_names ${option_names})
47 list(FIND loption_names
"${arg}" is_option)
48 if(is_option GREATER -1)
49 set(${prefix}_${arg} TRUE)
50 else(is_option GREATER -1)
51 set(current_arg_list ${current_arg_list}
"${arg}")
52 endif(is_option GREATER -1)
53 endif(is_arg_name GREATER -1)
54 endforeach(arg ${ARGN})
56 set(${prefix}_${current_arg_name} ${current_arg_list})
58 #------------------- finished parsing arguments ----------------------
61 set(copy_file "${FILTER_OUT}
")
63 set(copy_file "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CMakeDoxygenFilter${CMAKE_EXECUTABLE_SUFFIX}
")
68 set(compile_defs "${compile_defs} -DUSE_NAMESPACE=${FILTER_NAMESPACE}
")
71 set(cmake_doxygen_filter_src "${CMAKE_CURRENT_SOURCE_DIR}/CMakeDoxygenFilter.cpp
")
73 try_compile(result_var
74 "${CMAKE_CURRENT_BINARY_DIR}
"
75 "${cmake_doxygen_filter_src}
"
76 COMPILE_DEFINITIONS ${compile_defs}
77 OUTPUT_VARIABLE compile_output
78 COPY_FILE ${copy_file}
82 message(FATAL_ERROR "error: Faild to compile ${cmake_doxygen_filter_src} (result: ${result_var})\n${compile_output}
")
85 set(CMakeDoxygenFilter_EXECUTABLE "${copy_file}
" PARENT_SCOPE)
mitkFunctionCMakeDoxygenFilterCompile()
Download and compile a CMake doxygen input filter.