macro(strfy _input _postfix)
  get_filename_component(_basename "${_input}" NAME_WE)
  get_filename_component(_suffix "${_input}" EXT)
  get_filename_component(_path "${_input}" PATH)
  string(SUBSTRING ${_suffix} 1 -1 _suffix)
  string(TOUPPER "SO_${_basename}_${_suffix}_H" COIN_HEADER_DEF)
  string(TOUPPER ${_basename} COIN_TEXTVAR_NAME)
  set(COIN_TEXTVAR_NAME "${COIN_TEXTVAR_NAME}${_postfix}")
  #message(STATUS "Parse: ${PROJECT_SOURCE_DIR}/${_input}")
  FILE(READ ${PROJECT_SOURCE_DIR}/${_input} f0)
  STRING(REGEX REPLACE "\\\\" "\\\\\\\\" f1 "${f0}")
  STRING(REGEX REPLACE "\"" "\\\\\"" f2 "${f1}")
  STRING(REGEX REPLACE "\r?\n" "\\\\n\"\n  \"" COIN_STR_SOURCE_CODE "${f2}")
  configure_file(strfytemplate.cmake.in "${_path}/${_basename}.h")
endmacro()

file(GLOB_RECURSE COIN_SHADER_GLSL RELATIVE ${PROJECT_SOURCE_DIR} *.glsl)
foreach(_input_file ${COIN_SHADER_GLSL})
  strfy(${_input_file} "_shadersource")
endforeach()
file(GLOB_RECURSE COIN_SHADER_INVENTOR RELATIVE ${PROJECT_SOURCE_DIR} *.iv)
foreach(_input_file ${COIN_SHADER_INVENTOR})
  strfy(${_input_file} "_draggergeometry")
endforeach()

file(GLOB_RECURSE COMMON_SCXML ${CMAKE_CURRENT_SOURCE_DIR}/[cep]*.xml)
file(GLOB_RECURSE COMMON_DRAGGERDEFAULTS ${CMAKE_CURRENT_SOURCE_DIR}/*.iv)
file(GLOB_RECURSE COMMON_SHADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.glsl)

set(COMMON_RESOURCES ${COMMON_SCXML} ${COMMON_DRAGGERDEFAULTS} ${COMMON_SHADERS} PARENT_SCOPE)
