CMakeCPack.cmake 5.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================

13
# If the cmake version includes cpack, use it
14 15 16
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
  if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
    option(CMAKE_INSTALL_DEBUG_LIBRARIES
17
      "Install Microsoft runtime debug libraries with CMake." FALSE)
18
    mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES)
19 20

    # By default, do not warn when built on machines using only VS Express:
21 22 23
    if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
      set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
    endif()
24

25
    include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
26
  endif()
27

28 29 30 31
  set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
  set(CPACK_PACKAGE_VENDOR "Kitware")
  set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
  set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
32
  set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
33
  set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
34
  set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
35
  set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
36 37 38 39 40

  # Installers for 32- vs. 64-bit CMake:
  #  - Root install directory (displayed to end user at installer-run time)
  #  - "NSIS package/display name" (text used in the installer GUI)
  #  - Registry key used to store info about the installation
41 42
  if(CMAKE_CL_64)
    set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
43
    set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
44 45
  else()
    set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
46
    set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
47
  endif()
48
  set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
49

50
  if(NOT DEFINED CPACK_SYSTEM_NAME)
51 52
    # make sure package is not Cygwin-unknown, for Cygwin just
    # cygwin is good for the system name
53 54
    if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
      set(CPACK_SYSTEM_NAME Cygwin)
55
    else()
56
      set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
57 58
    endif()
  endif()
59 60 61
  if(${CPACK_SYSTEM_NAME} MATCHES Windows)
    if(CMAKE_CL_64)
      set(CPACK_SYSTEM_NAME win64-x64)
62
    else()
63
      set(CPACK_SYSTEM_NAME win32-x86)
64 65
    endif()
  endif()
66

67
  if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
68
    # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
69
    # default to source package - system, on cygwin system is not
70
    # needed
71 72
    if(CYGWIN)
      set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
73
    else()
74
      set(CPACK_PACKAGE_FILE_NAME
75
        "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
76 77
    endif()
  endif()
78

79
  set(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
80

81 82 83 84
  if(UNIX)
    set(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
    set(CPACK_SOURCE_STRIP_FILES "")
    set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
85
  endif()
86 87

  # cygwin specific packaging stuff
88
  if(CYGWIN)
89
    # setup the cygwin package name
90
    set(CPACK_PACKAGE_NAME cmake)
91
    # setup the name of the package for cygwin cmake-2.4.3
92
    set(CPACK_PACKAGE_FILE_NAME
93
      "${CPACK_PACKAGE_NAME}-${CMake_VERSION}")
94
    # the source has the same name as the binary
95
    set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
96 97
    # Create a cygwin version number in case there are changes for cygwin
    # that are not reflected upstream in CMake
98 99
    set(CPACK_CYGWIN_PATCH_NUMBER 1 CACHE STRING "patch number for CMake cygwin packages")
    mark_as_advanced(CPACK_CYGWIN_PATCH_NUMBER)
100 101
    # These files are required by the cmCPackCygwinSourceGenerator and the files
    # put into the release tar files.
102
    set(CPACK_CYGWIN_BUILD_SCRIPT
103
      "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.sh")
104
    set(CPACK_CYGWIN_PATCH_FILE
105
      "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.patch")
106 107 108
    # include the sub directory cmake file for cygwin that
    # configures some files and adds some install targets
    # this file uses some of the package file name variables
109
    include(Utilities/Release/Cygwin/CMakeLists.txt)
110
  endif()
111

112 113
  set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")

114
  # Set the options file that needs to be included inside CMakeCPackOptions.cmake
115 116
  set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
  configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
117
    "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
118
  set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
119

120
  # include CPack model once all variables are set
121
  include(CPack)
122
endif()