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