Computer Assited Medical Intervention Tool Kit  version 4.1
CamiTKAddSubProject.h
Go to the documentation of this file.
46 
47  set(options "")
48  set(oneValueArgs ACTION COMPONENT CEP_LIBRARY APPLICATION CORELIB)
49  set(multiValueArgs DEPENDENCIES)
50  cmake_parse_arguments(ADD_SUB_PROJECT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
51 
52  #
53  # 1. get the subproject name and add it to the corresponding target list
54  #
55 
56  # CORE LIBRARIES
57  if(ADD_SUB_PROJECT_CORELIB)
58  set(SUB_PROJECT_NAME ${ADD_SUB_PROJECT_CORELIB})
59  endif()
60 
61  # LIBRARY
62  if(ADD_SUB_PROJECT_CEP_LIBRARY)
63  set(SUB_PROJECT_NAME ${ADD_SUB_PROJECT_CEP_LIBRARY})
64  # Add the project to the corresponding list
65  set(CAMITK_CEP_LIBRARY_TARGETS ${CAMITK_CEP_LIBRARY_TARGETS} ${SUB_PROJECT_NAME} CACHE STRING "List of library targets" FORCE)
66  endif()
67 
68  # COMPONENTS
69  if(ADD_SUB_PROJECT_COMPONENT)
70  set(SUB_PROJECT_NAME ${ADD_SUB_PROJECT_COMPONENT})
71  # Add the project to the corresponding list
72  set(CAMITK_COMPONENT_TARGETS ${CAMITK_COMPONENT_TARGETS} ${SUB_PROJECT_NAME} CACHE STRING "List of component extension targets" FORCE)
73  endif()
74 
75  # ACTIONS
76  if(ADD_SUB_PROJECT_ACTION)
77  set(SUB_PROJECT_NAME ${ADD_SUB_PROJECT_ACTION})
78  # Add the project to the corresponding list
79  set(CAMITK_ACTION_TARGETS ${CAMITK_ACTION_TARGETS} ${SUB_PROJECT_NAME} CACHE STRING "List of action extension targets" FORCE)
80  endif()
81 
82  # APPLICATION
83  if(ADD_SUB_PROJECT_APPLICATION)
84  set(SUB_PROJECT_NAME ${ADD_SUB_PROJECT_APPLICATION})
85  # Add the project to the corresponding list
86  set(CAMITK_APPLICATION_TARGETS ${CAMITK_APPLICATION_TARGETS} ${SUB_PROJECT_NAME} CACHE STRING "List of application targets" FORCE)
87  endif()
88 
89  #
90  # 2. Create the XML fragment (including name and dependency list
91  #
92  set(SUBPROJECT_XML_FRAGMENT "\n <SubProject name=\"${SUB_PROJECT_NAME}\">")
93  if(SUB_PROJECT_NAME STREQUAL "action-application")
94  # Particular case of action-applications: only depends on CamiTK core library
95  set(SUBPROJECT_XML_FRAGMENT ${SUBPROJECT_XML_FRAGMENT} "<Dependency name=\"library-camitkcore\"/>")
96  else()
97  # concatenate all dependencies
98  foreach(DEPENDENCY ${ADD_SUB_PROJECT_DEPENDENCIES})
99  set(SUBPROJECT_XML_FRAGMENT ${SUBPROJECT_XML_FRAGMENT} "<Dependency name=\"${DEPENDENCY}\"/>")
100  endforeach()
101  endif()
102  set(SUBPROJECT_XML_FRAGMENT ${SUBPROJECT_XML_FRAGMENT} "</SubProject>")
103 
104  #
105  # 3. add the project to the list of the CEP/CEP set subprojects
106  #
107  set(CAMITK_TARGETS ${CAMITK_TARGETS} ${SUB_PROJECT_NAME} CACHE INTERNAL "")
108 
109  #
110  # 4. add the xml fragment for the corresponding subproject XML fragment
111  #
112 
113  # CORE LIBRARIES
114  if(ADD_SUB_PROJECT_CORELIB)
115  set(CAMITK_CORE_LIBRARY_SUBPROJECTS ${CAMITK_CORE_LIBRARY_SUBPROJECTS} ${SUBPROJECT_XML_FRAGMENT} CACHE INTERNAL "XML description of Core library subprojects")
116  endif()
117 
118  # LIBRARY
119  if(ADD_SUB_PROJECT_CEP_LIBRARY)
120  set(CAMITK_CEP_LIBRARY_SUBPROJECTS ${CAMITK_CEP_LIBRARY_SUBPROJECTS} ${SUBPROJECT_XML_FRAGMENT} CACHE INTERNAL "XML description of library subprojects")
121  endif()
122 
123  # COMPONENTS
124  if(ADD_SUB_PROJECT_COMPONENT)
125  set(CAMITK_COMPONENT_SUBPROJECTS ${CAMITK_COMPONENT_SUBPROJECTS} ${SUBPROJECT_XML_FRAGMENT} CACHE INTERNAL "XML description of component extension subprojects")
126  endif()
127 
128  # ACTIONS
129  if(ADD_SUB_PROJECT_ACTION)
130  # Particular case of action-applications
131  if(SUB_PROJECT_NAME STREQUAL "action-application")
132  set(CAMITK_APPLICATION_ACTION_SUBPROJECTS ${CAMITK_APPLICATION_ACTION_SUBPROJECTS} ${SUBPROJECT_XML_FRAGMENT} CACHE INTERNAL "XML description of application action extension subprojects")
133  else()
134  set(CAMITK_ACTION_SUBPROJECTS ${CAMITK_ACTION_SUBPROJECTS} ${SUBPROJECT_XML_FRAGMENT} CACHE INTERNAL "XML description of action extension subprojects")
135  endif()
136  endif()
137 
138  # APPLICATION
139  if(ADD_SUB_PROJECT_APPLICATION)
140  # Add the xml fragment for the current subproject
141  set(CAMITK_APPLICATION_SUBPROJECTS ${CAMITK_APPLICATION_SUBPROJECTS} ${SUBPROJECT_XML_FRAGMENT} CACHE INTERNAL "XML description of application subprojects")
142  endif()
143 
144 end(){)
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
camitk_register_subproject()
macro camitk_register_subproject adds a subproject definition for the CDash report ...
Definition: CamiTKAddSubProject.h:45