
#-----------------------------------------------------------------------------
# Build a CPack installer if CPack is available and this is a build of just
# CTKAppLauncher (as opposed to a build of CTKAppLauncher included in some other project...)

if("${CTKAppLauncher_BINARY_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")

  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
    set(CPACK_SYSTEM_NAME "win-i386")
    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
      set(CPACK_SYSTEM_NAME "win-amd64")
    endif()
  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    set(CPACK_SYSTEM_NAME "linux-i386")
    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
      set(CPACK_SYSTEM_NAME "linux-amd64")
    endif()
  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
    if(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
      set(CPACK_SYSTEM_NAME "macosx-ppc")
    else()
      set(CPACK_SYSTEM_NAME "macosx-i386")
      if(CMAKE_SIZEOF_VOID_P EQUAL 8)
        set(CPACK_SYSTEM_NAME "macosx-amd64")
      endif()
    endif()
  endif()
  
  set(CPACK_MONOLITHIC_INSTALL ON)
  set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CTKAppLauncher - The Common Toolkit Application Launcher")
  set(CPACK_PACKAGE_VENDOR "Kitware, Inc.")
  #set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
  #set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
  set(CPACK_PACKAGE_VERSION "${CTKAppLauncher_VERSION}")
  set(CPACK_PACKAGE_INSTALL_DIRECTORY "CTKAppLauncher ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
  set(CPACK_PACKAGE_EXECUTABLES "CTKAppLauncher")
  set(CPACK_GENERATOR "TGZ")
  include(CPack)
endif()

