Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkMacroMultiplexPicType.cmake
Go to the documentation of this file.
1 #
2 # MITK_MULTIPLEX_PICTYPE: generate separated source files for different
3 # data types to reduce memory consumption of compiler during template
4 # instantiation
5 #
6 # Param "file" should be named like mitkMyAlgo-TYPE.cpp
7 # in the file, every occurence of @TYPE@ is replaced by the
8 # datatype. For each datatype, a new file mitkMyAlgo-datatype.cpp
9 # is generated and added to CPP_FILES_GENERATED.
10 #
11 macro(MITK_MULTIPLEX_PICTYPE file)
12  string(REPLACE "," ";" TYPES "${MITK_ACCESSBYITK_PIXEL_TYPES}")
13  foreach(TYPE ${TYPES})
14  # create filename for destination
15  string(REPLACE " " "_" quoted_type "${TYPE}")
16  string(REPLACE TYPE ${quoted_type} quoted_file ${file})
17  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR}/${quoted_file} @ONLY)
18  set(CPP_FILES_GENERATED ${CPP_FILES_GENERATED} ${CMAKE_CURRENT_BINARY_DIR}/${quoted_file})
19  endforeach(TYPE)
20 endmacro(MITK_MULTIPLEX_PICTYPE)
static const std::string filename
MITK_MULTIPLEX_PICTYPE(file)