set(CPACK_IGNORE_FILES "CMakeCache.txt;install_manifest.txt;/Testing/;/Makefile$;\\\\.tar.gz$;\\\\.so[.0-9]*$;/build/;/_CPack_Packages/;/CMakeFiles/;/CVS/;/\\\\.svn/;/\\\\.git/;\\\\.swp$;\\\\.#;/#")
set(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES})
set(CPACK_SOURCE_GENERATOR TXZ ZIP)
set(CPACK_SOURCE_TOPLEVEL_TAG "")

function(set_project_version MAJOR MINOR PATCH)
  if(NOT PROJECT_NAME OR "${PROJECT_NAME}" STREQUAL "Project")
    message(FATAL_ERROR "PROJECT_NAME MUST be defined before calling set_project_version()")
  endif()
  set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR})
  set(CPACK_PACKAGE_VERSION_MINOR ${MINOR})
  set(CPACK_PACKAGE_VERSION_PATCH ${PATCH})
  set(CPACK_PACKAGE_VERSION "${MAJOR}.${MINOR}.${PATCH}")
  set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
  set(PROJECT_VERSION "${CPACK_PACKAGE_VERSION}" PARENT_SCOPE)
  set(PROJECT_VERSION_MAJOR "${MAJOR}" PARENT_SCOPE)
  set(PROJECT_VERSION_MINOR "${MINOR}" PARENT_SCOPE)
  set(PROJECT_VERSION_PATCH "${PATCH}" PARENT_SCOPE)
  include(CPack)
endfunction(set_project_version)

