#################################################
#
#  (C) 2010-2011 Serghei Amelian
#  serghei (DOT) amelian (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

function( generate_tar output source )
  add_custom_target( ${output} ALL
  COMMAND ${TAR} -zcf ${output} --exclude=.svn --exclude=*.cdbs-orig -C ${CMAKE_CURRENT_SOURCE_DIR}/${source} ${ARGN} )
endfunction( )

generate_tar( admin.tar.gz "" admin )
generate_tar( gnome.tar.gz gnome macros )
generate_tar( gnome2.tar.gz gnome2 macros )
generate_tar( gnu.tar.gz gnu AUTHORS COPYING ChangeLog INSTALL NEWS README TODO )
generate_tar( wxwidgets.tar.gz wx macros )
generate_tar( incadmin.tar.gz incadmin config.guess config.sub depcomp install-sh ltmain.sh  missing  mkinstalldirs )
generate_tar( scons.tar.gz scons configure admin/scons-mini.tar.bz2 admin/generic.py admin/kde.py )

install( FILES
    ${CMAKE_CURRENT_BINARY_DIR}/admin.tar.gz
    ${CMAKE_CURRENT_BINARY_DIR}/gnu.tar.gz
    ${CMAKE_CURRENT_BINARY_DIR}/incadmin.tar.gz
    ${CMAKE_CURRENT_BINARY_DIR}/gnome.tar.gz
    ${CMAKE_CURRENT_BINARY_DIR}/gnome2.tar.gz
    ${CMAKE_CURRENT_BINARY_DIR}/wxwidgets.tar.gz
    kde-Makefile.am kde-Makefile.cvs
    tde-configure.in.in tde-index.docbook
    kde-po-Makefile.am kde-doc-Makefile.am
    kde-doc-en-Makefile.am hi16-app-app.png
    hi32-app-app.png tde-app.desktop
    tde-part.desktop
    gnome-Makefile.am gnome-Makefile.cvs
    gnome-pixmaps-Makefile.am gnome-app.png
    wx-configure.in wx-Makefile.am wx-Makefile.cvs
    COPYING COPYING.LIB LICENSE.QPL LICENSE.BSD
    Artistic admin.kdevtemplate gnu.kdevtemplate
    dockbook.kdevtemplate incadmin.kdevtemplate
    gnome2.kdevtemplate scons.kdevtemplate
    ${CMAKE_CURRENT_BINARY_DIR}/scons.tar.gz
  DESTINATION ${DATA_INSTALL_DIR}/kdevappwizard/template-common )
