3 #
get all files called
"main.cpp" 4 file(GLOB_RECURSE main_cpp_list
"${snippet_path}/main.cpp")
6 foreach(main_cpp_file ${main_cpp_list})
7 #
get the directory containing the
main.cpp file
8 get_filename_component(main_cpp_dir
"${main_cpp_file}" PATH)
10 set(snippet_src_files )
12 # If there exists a
"files.cmake" file
in the snippet directory,
13 # include it and assume it sets the variable
"snippet_src_files" 14 # to a list of source files
for the snippet.
15 if(EXISTS
"${main_cpp_dir}/files.cmake")
16 include(
"${main_cpp_dir}/files.cmake")
17 set(_tmp_src_files ${snippet_src_files})
18 set(snippet_src_files )
19 foreach(_src_file ${_tmp_src_files})
20 if(IS_ABSOLUTE ${_src_file})
21 list(APPEND snippet_src_files ${_src_file})
23 list(APPEND snippet_src_files ${main_cpp_dir}/${_src_file})
27 # glob all files in the directory and add them to the snippet src list 28 file(GLOB_RECURSE snippet_src_files
"${main_cpp_dir}/*")
31 # Uset the top-level directory name as the executable name 32 string(REPLACE
"/" ";" main_cpp_dir_tokens
"${main_cpp_dir}")
33 list(GET main_cpp_dir_tokens -1 snippet_exec_name)
34 set(snippet_target_name
"Snippet-${snippet_exec_name}")
35 add_executable(${snippet_target_name} ${snippet_src_files})
37 target_link_libraries(${snippet_target_name} ${ARGN})
39 set_target_properties(${snippet_target_name} PROPERTIES
41 RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/snippets" 42 ARCHIVE_OUTPUT_DIRECTORY
"${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/snippets" 43 LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/snippets" 44 OUTPUT_NAME ${snippet_exec_name}
45 FOLDER
"${MITK_ROOT_FOLDER}/Documentation/Snippets" int main(int argc, char **argv)
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
mitkFunctionCompileSnippets(snippet_path)