Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkFunctionGenerateProjectXml.cmake
Go to the documentation of this file.
1 
2 
3 function(mitkFunctionGenerateProjectXml dir name targets is_superbuild)
4  if(NOT EXISTS ${dir})
5  message(FATAL_ERROR "Directory ${dir} doesn't exist!")
6  endif()
7 
8  set(xml_subprojects )
9 
10  if(${is_superbuild})
11  set(xml_subprojects ${xml_subprojects} " <SubProject name=\"SuperBuild\">\n")
12  endif()
13 
14  foreach(target ${targets})
15 
16  # Remarks: Project.xml should contains all sub-project. That way
17  # all dashboards should submit a similar file.
18 
19  set(xml_subprojects ${xml_subprojects} " <SubProject name=\"${target}\">\n")
20 
21  if(${is_superbuild})
22  set(xml_subprojects ${xml_subprojects} " <Dependency name=\"SuperBuild\"/>\n")
23  endif()
24 
25  # Generate XML related to the dependencies
26  #foreach(dependency_name ${dependencies})
27  # set(xml_subprojects ${xml_subprojects} " <Dependency name=\"${dependency_name}\"/>\n")
28  #endforeach()
29 
30  set(xml_subprojects ${xml_subprojects} " </SubProject>\n")
31  endforeach()
32 
33  set(xml_subprojects ${xml_subprojects} " <SubProject name=\"Documentation\">\n")
34  foreach(subproject ${targets})
35  set(xml_subprojects ${xml_subprojects} " <Dependency name=\"${subproject}\"/>\n")
36  endforeach()
37  set(xml_subprojects ${xml_subprojects} " </SubProject>\n")
38 
39  set(xml_content "<Project name=\"${name}\">\n${xml_subprojects}</Project>")
40  set(filename "${dir}/Project.xml")
41 
42  file(WRITE ${filename} ${xml_content})
43  message(STATUS "Generated: ${filename}")
44 endfunction()
45 
mitkFunctionGenerateProjectXml(dir, name, targets, is_superbuild)