cmake_minimum_required(VERSION 2.6)

#
# Project information
#

project(sitplus)

set(APP_NAME "sitplus")
set(SITPLUS_MAJOR_VERSION 1)
set(SITPLUS_MINOR_VERSION 0)
set(SITPLUS_REVISION_VERSION 3)
set(SITPLUS_VERSION "${SITPLUS_MAJOR_VERSION}.${SITPLUS_MINOR_VERSION}.${SITPLUS_REVISION_VERSION}")

#
# if this is set to ON, then all libraries are built as shared libraries by default.
#

SET(BUILD_SHARED_LIBS OFF CACHE BOOL 
	"Build shared libraries as default?")

#
# if this is set to ON, then all libraries are built as shared libraries by default.
#

SET(BUILD_TESTS OFF CACHE BOOL 
	"Build tests?")
	

#
# Generate Doxygen doc
#

SET(GENERATE_DOXYGEN ON CACHE BOOL 
	"Generate Doxygen documentation?")
	
#set(WHOLE_PROGRAM_OPTIMIZATION OFF CACHE BOOL "Flags for whole program optimization.")

SET(CMAKE_VERBOSE_MAKEFILE false)

if(WIN32)
	set(_WIN32_WINNT "0x0500")
endif(WIN32)

#
# Set default build mode
#

IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE Release CACHE STRING
      "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

#
# Directories and RPATH
#

set (BINDIR "bin")

if (WIN32)
	set (LIBDIR "lib")
	set (LOCALEDIR "${BINDIR}/locale")
	set (DATADIR "${BINDIR}")
	set (DOCDIR "${BINDIR}/doc")
	set (PLUGINDIR "${BINDIR}")
	set (LIBRUNTIMEDIR "${BINDIR}")
else(WIN32)
	set (LIBDIR "lib/${APP_NAME}")
	set (LOCALEDIR "share/locale")
	set (DATADIR "share/${APP_NAME}")
	set (DOCDIR "${DATADIR}/doc")
	set (PLUGINDIR "lib/${APP_NAME}")
	set (LIBRUNTIMEDIR "lib/${APP_NAME}")
	set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
endif(WIN32)


#
# PATHS
# 
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")

INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/3rdparty)
# For the add_library & add_executable commands
set (CUSTOM_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/include")
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${BINDIR})
set (LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})

#set (RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})

#
# Additional compiler flags. Needed for Linux 64 bit 
#
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-fPIC)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")

#
# Testing
#

#ENABLE_TESTING()

#####################################################################
# MACROS
#####################################################################

# - Copies a file to the MSVC build directories
#
# Visual Studio users expect to be able to click "Run" and have the application
# run correctly from the build directory. This macro provides the ability to 
# install files to the build directory so that his behaviour works as expected.
#
# This module defines the following macros:
# install_to_msvc_build_directory
macro(install_to_msvc_build_directory INSTALL_PREFIX_DIR INSTALL_FILE)
    #foreach(_MSVC_BUILD_TYPE ${CMAKE_CONFIGURATION_TYPES})
	foreach(_MSVC_BUILD_TYPE ${CMAKE_BUILD_TYPE})	
        set(_OUTPUT_DIRECTORY "${INSTALL_PREFIX_DIR}/${_MSVC_BUILD_TYPE}")
        if (${ARGC} STRGREATER 2)
            set(_INSTALL_SUFFIX_DIR ${ARGV2})
            set(_OUTPUT_DIRECTORY "${_OUTPUT_DIRECTORY}/${_INSTALL_SUFFIX_DIR}")
        endif (${ARGC} STRGREATER 2)
        
        get_filename_component(_INSTALL_FILENAME "${INSTALL_FILE}" NAME)
        configure_file(
            ${INSTALL_FILE}
            ${_OUTPUT_DIRECTORY}/${_INSTALL_FILENAME}
            COPYONLY
        )
    endforeach(_MSVC_BUILD_TYPE ${CMAKE_CONFIGURATION_TYPES})
endmacro(install_to_msvc_build_directory)

#####################################################################
# Required libraries
#####################################################################

#
# Boost
#

IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
	set(Boost_USE_STATIC_LIBS OFF)
	set(Boost_USE_STATIC_RUNTIME    OFF)
else ()
	set(Boost_USE_STATIC_LIBS ON)
endif()
set(Boost_USE_MULTITHREAD ON)
#set(Boost_USE_STATIC_RUNTIME    OFF)

find_package(Boost COMPONENTS thread REQUIRED)
find_package(Boost COMPONENTS program_options REQUIRED)
message(STATUS "Boost_INCLUDE_DIR    : ${Boost_INCLUDE_DIR}")
message(STATUS "Boost_THREAD_LIBRARY : ${Boost_THREAD_LIBRARY}")
message(STATUS "Boost_PROGRAM_OPTIONS_LIBRARY : ${Boost_PROGRAM_OPTIONS_LIBRARY}")

# Boost version 1.39 or greater required 
# Lower versions fail to compile with g++ 4.4
IF ((${Boost_MAJOR_VERSION} LESS 1) OR 
	(${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} LESS 39))
	MESSAGE (FATAL_ERROR "Boost version less than 1.39")
ENDIF()
include_directories ( ${Boost_INCLUDE_DIRS} )
link_directories ( ${Boost_LIBRARY_DIRS} )

#
# POCO
#

find_package(POCO)
if(WIN32)
	find_file (POCO_FOUNDATION_RUNTIMED bin/PocoFoundationd.dll HINTS $ENV{POCO_ROOT})
#	find_file (POCO_XML_RUNTIMED bin/PocoXMLd.dll HINTS $ENV{POCO_ROOT})
	find_file (POCO_FOUNDATION_RUNTIME bin/PocoFoundation.dll HINTS $ENV{POCO_ROOT})
#	find_file (POCO_XML_RUNTIME bin/PocoXML.dll HINTS $ENV{POCO_ROOT})
	if (MSVC)
		install_to_msvc_build_directory("${EXECUTABLE_OUTPUT_PATH}" "${POCO_FOUNDATION_RUNTIMED}")
#		install_to_msvc_build_directory("${EXECUTABLE_OUTPUT_PATH}" "${POCO_XML_RUNTIMED}")
	endif(MSVC)
	
#	install(FILES ${POCO_FOUNDATION_RUNTIMED} ${POCO_XML_RUNTIMED} DESTINATION "${BINDIR}" CONFIGURATIONS Debug)
#	install(FILES ${POCO_FOUNDATION_RUNTIME} ${POCO_XML_RUNTIME} DESTINATION "${BINDIR}" CONFIGURATIONS Release RelWithDebInfo)
	
	install(FILES ${POCO_FOUNDATION_RUNTIMED} DESTINATION "${BINDIR}" CONFIGURATIONS Debug)
	install(FILES ${POCO_FOUNDATION_RUNTIME} DESTINATION "${BINDIR}" CONFIGURATIONS Release RelWithDebInfo)
endif(WIN32)

#
# wxWidgets
#

option(ENABLE_WXWIDGETS "Enable wxWidgets support" 1)

if (ENABLE_WXWIDGETS)
	if(WIN32)
		set(wxWidgets_CONFIGURATION "mswu")
	else(WIN32)
		if (CMAKE_BUILD_TYPE MATCHES Debug)
			set(wxWidgets_USE_DEBUG ON)
		else()
			set(wxWidgets_USE_DEBUG OFF)
		endif()
		set(wxWidgets_USE_UNICODE TRUE)
	endif(WIN32)
	message (STATUS "wxWidgets_USE_DEBUG : ${wxWidgets_USE_DEBUG}")

	find_package(wxWidgets COMPONENTS core base REQUIRED)
	include(${wxWidgets_USE_FILE})
	message(STATUS "wxWidgets_LIBRARIES : ${wxWidgets_LIBRARIES}")
	message(STATUS "wxWidgets_DEFINITIONS : ${wxWidgets_DEFINITIONS}")
	message(STATUS "wxWidgets_DEFINITIONS_DEBUG : ${wxWidgets_DEFINITIONS_DEBUG}")
	message(STATUS "wxWidgets_ROOT_DIR	: ${wxWidgets_ROOT_DIR}")

	# Make sure wxWidgets are available for debugging
	if (WIN32)
		if (MSVC)
			install_to_msvc_build_directory( "${EXECUTABLE_OUTPUT_PATH}" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxbase28ud_vc_custom.dll")
			install_to_msvc_build_directory( "${EXECUTABLE_OUTPUT_PATH}" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxmsw28ud_core_vc_custom.dll")
		endif(MSVC)
	
		install(FILES "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxbase28ud_vc_custom.dll" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxmsw28ud_core_vc_custom.dll" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxmsw28ud_adv_vc_custom.dll" DESTINATION "${BINDIR}" CONFIGURATIONS Debug)
		install(FILES "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxbase28u_vc_custom.dll" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxmsw28u_core_vc_custom.dll" "${wxWidgets_ROOT_DIR}/lib/vc_dll/wxmsw28u_adv_vc_custom.dll" DESTINATION "${BINDIR}" CONFIGURATIONS Release RelWithDebInfo)
	endif(WIN32)
endif (ENABLE_WXWIDGETS)

#
# i18n
#

option(ENABLE_NLS "Enable translations support and building" ON)
if (ENABLE_NLS)
	if (WIN32)
		option(ENABLE_POT_UPDATE_TARGET "Enables the tools to update the pot files." OFF)
	else(WIN32)
		option(ENABLE_POT_UPDATE_TARGET "Enables the tools to update the pot files." ON)
	endif(WIN32)

	find_package(Gettext REQUIRED)
	find_package(Libintl REQUIRED)

	if(ENABLE_POT_UPDATE_TARGET)
		find_package(TranslationTools REQUIRED)
	endif(ENABLE_POT_UPDATE_TARGET)
	
	# get languages
	file(READ po/LINGUAS LINGUAS)
	string(REPLACE "\n" "" LINGUAS ${LINGUAS})
	separate_arguments(LINGUAS)
	
	INCLUDE_DIRECTORIES(BEFORE ${LIBINTL_INCLUDE_DIR})
	add_subdirectory(po)
	
	if(WIN32)
		install(FILES "${LIBINTL_ROOT_PATH}/bin/libintl3.dll"  "${LIBINTL_ROOT_PATH}/bin/libiconv2.dll" DESTINATION "${BINDIR}")
	endif(WIN32)	
endif (ENABLE_NLS)

#####################################################################
# configuration file
#####################################################################
configure_file ("${PROJECT_SOURCE_DIR}/include/config.h.in"
                "${PROJECT_BINARY_DIR}/include/config.h" )
configure_file ("${PROJECT_SOURCE_DIR}/include/version.h.in"
                "${PROJECT_BINARY_DIR}/include/version.h" )
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_BINARY_DIR}/include/)

#####################################################################
# Compiler flags
#####################################################################
#
#  Maximum level of warnings enabled
# 

set(EXTRA_C_FLAGS "")
set(EXTRA_C_FLAGS_RELEASE "")
set(EXTRA_C_FLAGS_DEBUG "")
set(EXTRA_EXE_LINKER_FLAGS "")
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "")
set(EXTRA_EXE_LINKER_FLAGS_DEBUG "")

if(MSVC)
    set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
    # 64-bit portability warnings, in MSVC8
    if(MSVC80)
        set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Wp64")
    endif()
    if(MSVC90)
	set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
    endif()

    set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")

    # Whole program optimization
    if(WHOLE_PROGRAM_OPTIMIZATION AND MSVC_VERSION GREATER 1300)
        set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /GL")
        set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
        set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
    endif()   
endif()

if(CMAKE_COMPILER_IS_GNUCXX)
    # High level of warnings.
    set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")

    # The -Wno-long-long is required in 64bit systems when including sytem headers.
    if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
    set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
    endif()
    if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*)
    set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
    endif()

    # Whole program optimization
    if(WHOLE_PROGRAM_OPTIMIZATION)
        set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fwhole-program --combine")
    endif()

    # Other optimizations
    if(USE_OMIT_FRAME_POINTER)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer")
    endif()
    if(USE_O2)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2")
    endif()
    if(USE_O3)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3")
    endif()
    if(USE_FAST_MATH)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -ffast-math")
    endif()
    if(USE_POWERPC)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5")
    endif()
    if(USE_MMX)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -mmmx")
    endif()
    # SSE should be disabled under MingW because it generates compiler errors
    if(USE_SSE)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse")
    endif()
    # SSE2 should be disabled under MingW because it generates compiler errors
    if(USE_SSE2)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse2")
    endif()
    # SSE3 should be disabled under MingW because it generates compiler errors
    if(USE_SSE3 AND NOT MINGW)
       set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -msse3")
    endif()

    set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")
    set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_EXE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${EXTRA_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${EXTRA_EXE_LINKER_FLAGS_DEBUG}")

if (WIN32 AND MSVC)  
    string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
    string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
    string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()


#####################################################################
# Doxygen
#####################################################################
IF(GENERATE_DOXYGEN)
	if (0)
	# check if doxygen is even installed
	find_package(Doxygen)
	if (DOXYGEN_FOUND STREQUAL "NO")
		message(FATAL_ERROR "Doxygen not found. Please get a copy http://www.doxygen.org")
	endif (DOXYGEN_FOUND STREQUAL "NO")

	# prepare doxygen configuration file
	configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

	# add doxygen as target
	add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

	# cleanup $build/api-doc on "make clean"
	set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES api-doc)

	# add doxygen as dependency to doc-target
	get_target_property(DOC_TARGET doc TYPE)
	if(NOT DOC_TARGET)
		add_custom_target(doc)
	endif()
	add_dependencies(doc doxygen)

	endif(0)
ENDIF(GENERATE_DOXYGEN)

# install HTML API documentation and manual pages
#set(DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}")

#install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/html
#         DESTINATION ${DOC_PATH}
#       )

# install man pages into packages, scope is now project root..
#install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/man/man3
#         DESTINATION share/man/man3/
#       )

#####################################################################
# Subdirectories
#####################################################################

add_subdirectory(3rdparty)
add_subdirectory(src)
add_subdirectory(doc)


#####################################################################
# Installation
#####################################################################

# Avoid installation for debug configurations
install(FILES ERROR-INSTALLING_DEBUG_CONFIGURATION DESTINATION "${DATADIR}" CONFIGURATIONS Debug RelWithDebInfo)

install(DIRECTORY pd DESTINATION "${DATADIR}")
install(DIRECTORY scores DESTINATION "${DATADIR}")
install(DIRECTORY sp DESTINATION "${DATADIR}")
install(DIRECTORY graphics DESTINATION "${DATADIR}")
install(DIRECTORY logos DESTINATION "${DATADIR}")
install(DIRECTORY audio DESTINATION "${DATADIR}")
install(FILES THANKS DESTINATION "${DATADIR}")

if (WIN32 AND MSVC)
	include (InstallRequiredSystemLibraries)
endif (WIN32 AND MSVC)

if(WIN32)
	SET(CPACK_GENERATOR "NSIS")
else(WIN32)
#	SET(CPACK_GENERATOR "STGZ;TGZ;TZ")
	SET(CPACK_GENERATOR "DEB")
endif(WIN32)

#SET(CPACK_INSTALL_CMAKE_PROJECTS "/home/andy/vtk/CMake-bin;CMake;ALL;/")
SET(CPACK_NSIS_DISPLAY_NAME "${APP_NAME} ${SITPLUS_VERSION}")
#SET(CPACK_OUTPUT_CONFIG_FILE "/home/andy/vtk/CMake-bin/CPackConfig.cmake")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "/home/andy/vtk/CMake/Copyright.txt")

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SITPLUS is a framework which provides novel forms of interaction for people with disabilities.")
SET(CPACK_PACKAGE_EXECUTABLES "sitplus;SITPLUS")

#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "SITPLUS")
#SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "CMake 2.5.0")

SET(CPACK_PACKAGE_FILE_NAME ${APP_NAME}-${SITPLUS_VERSION})
#SET(CPACK_PACKAGE_NAME ${APP_NAME}-${SITPLUS_VERSION})


SET(CPACK_PACKAGE_VENDOR "Cesar Mauri Loba - CREA Software Systems")

SET(CPACK_PACKAGE_VERSION ${SITPLUS_VERSION})
SET(CPACK_PACKAGE_VERSION_MAJOR ${SITPLUS_MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${SITPLUS_MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${SITPLUS_REVISION_VERSION})

SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
#SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/installnote.rtf")
#SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/installnote.rtf")

# Open manual after install
set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecShell open $INSTDIR\\\\bin\\\\doc\\\\manual.html")
#set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "!insertmacro MUI_LANGDLL_DISPLAY")

SET(CPACK_SOURCE_GENERATOR "TGZ")
#SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/home/andy/vtk/CMake-bin/CPackSourceConfig.cmake")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "sitplus-src")
SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_STRIP_FILES "true")
#SET(CPACK_SYSTEM_NAME "Linux-i686")
#SET(CPACK_TOPLEVEL_TAG "Linux-i686")
if (NOT WIN32)
	SET (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
else (NOT WIN32)
	SET(CPACK_PACKAGE_INSTALL_DIRECTORY "SITPLUS")
endif(NOT WIN32)

#
# DEB packager
#

SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Debian Med Packaging Team")

INCLUDE(CPack)

#
# Fake isntall for testing
#
#####################################################################
# Rubbish
#####################################################################

#add_custom_target(fake_install 
#    ALL
#    "${CMAKE_COMMAND}" 
#    -D CMAKE_INSTALL_PREFIX:string=${CMAKE_CURRENT_BINARY_DIR}/testdir
#    -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake" 
#    DEPENDS spcoremain  ) 


