Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkFunctionOrganizeSources.cmake
Go to the documentation of this file.
2 
3  # this functions gets a filelist as input and looks
4  # for corresponding h-files to add them to the project.
5 
6  # additionally files are grouped in source-groups.
7 
8  # No parameters explicitly declared here, because
9  # we want to allow for variable argument lists, which
10  # are later accessed by the keyword foreach(MYFILE ${ARGV})
11 
12  # output: after calling the macro, files that were found
13  # correspondigly to the given files are stored in the
14  # variable:
15  # ${CORRESPONDING_H_FILES}
16  # ${CORRESPONDING_TXX_FILES}
17  # ${CORRESPONDING_UI_H_FILES}
18 
19  # Globbed can be found in the variables
20  # ${GLOBBED_TXX_FILES} (CURRENTLY COMMENTED OUT)
21  # ${GLOBBED_DOX_FILES}
22 
23  cmake_parse_arguments(_ORG "" "" "HEADER;SOURCE;TXX;DOC;MOC;GEN_QRC;GEN_UI;META;UI;QRC" ${ARGN})
24 
25  set(CORRESPONDING__H_FILES "")
26  set(GLOBBED__H_FILES "")
27 
28  if(_ORG_SOURCE)
29  foreach(_file ${_ORG_SOURCE})
30  string(REGEX REPLACE "(.*)\\.(txx|cpp|c|cxx)$" "\\1.h" H_FILE ${_file})
31  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${H_FILE}")
32  list(APPEND CORRESPONDING__H_FILES "${H_FILE}")
33  endif()
34  endforeach()
35  else()
36  file(GLOB_RECURSE GLOBBED__H_FILES *.h)
37  endif()
38 
39  set(CORRESPONDING__H_FILES ${CORRESPONDING__H_FILES} PARENT_SCOPE)
40  set(GLOBBED__H_FILES ${GLOBBED__H_FILES} PARENT_SCOPE)
41 
42  if(_ORG_GEN_QRC OR _ORG_GEN_UI OR _ORG_MOC)
43  source_group("Generated\\Qt QRC Source Files" FILES ${_ORG_GEN_QRC})
44  source_group("Generated\\Qt UI Header Files" FILES ${_ORG_GEN_UI})
45  source_group("Generated\\Qt MOC Source Files" FILES ${_ORG_MOC})
46  endif()
47 
48  #_MACRO_APPEND_TO_LIST(_ORG_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/")
49  source_group("== Source Files ==" FILES ${_ORG_SOURCE})
50 
51  #_MACRO_APPEND_TO_LIST(_ORG_TXX "${CMAKE_CURRENT_SOURCE_DIR}/")
52  source_group("== Template Files ==" FILES ${_ORG_TXX})
53 
54  #_MACRO_APPEND_TO_LIST(_ORG_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/")
55  source_group("== Header Files ==" FILES ${_ORG_HEADER} ${CORRESPONDING__H_FILES} ${GLOBBED__H_FILES})
56 
57  if(_ORG_UI)
58  #_MACRO_APPEND_TO_LIST(_ORG_UI "${CMAKE_CURRENT_SOURCE_DIR}/")
59  source_group("QT UI Files" FILES ${_ORG_UI})
60  endif()
61 
62  if(_ORG_DOC)
63  #_MACRO_APPEND_TO_LIST(_ORG_DOC "${CMAKE_CURRENT_SOURCE_DIR}/")
64  source_group("Doxygen Files" FILES ${_ORG_DOC})
65  endif()
66 
67  if(_ORG_QRC)
68  #_MACRO_APPEND_TO_LIST(_ORG_QRC "${CMAKE_CURRENT_SOURCE_DIR}/")
69  source_group("Qt Resource Files" FILES ${_ORG_QRC})
70  endif()
71 
72  if(_ORG_META)
73  source_group("Plugin META Files" FILES ${_ORG_META})
74  endif()
75 
76 endfunction()
77 
78 macro(_MACRO_APPEND_TO_LIST _list _value)
79  set(_origlist ${${_list}})
80  set(${_list} )
81  foreach(_element ${_origlist})
82  list(APPEND ${_list} "${_value}${_element}")
83  endforeach()
84 endmacro()
85 
mitkFunctionOrganizeSources()
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244