ENH: typo
[cmake.git] / CMakeCPack.cmake
blob24eb061d27ba9b16edec19cf6df75fcb8bb7c4bd
1 # If the cmake version includes cpack, use it
2 IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
3   IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
4     SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
5     OPTION(CMAKE_INSTALL_DEBUG_LIBRARIES 
6       "Install Microsoft runtime debug libraries with CMake." FALSE)
7     MARK_AS_ADVANCED(CMAKE_INSTALL_DEBUG_LIBRARIES)
8     INCLUDE(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
9   ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
10   CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
11     "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
12   SET(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
13   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
14   SET(CPACK_PACKAGE_VENDOR "Kitware")
15   SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
16   SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
17   SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}")
18   SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
19 # if version date is set then use that as the patch 
20   IF(CMake_VERSION_DATE)
21     SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_DATE}")
22   ELSE(CMake_VERSION_DATE)
23     SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
24   ENDIF(CMake_VERSION_DATE)
25   SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
26   SET(CPACK_SOURCE_PACKAGE_FILE_NAME
27     "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
28   IF(CMake_VERSION_RC)
29     SET(CPACK_SOURCE_PACKAGE_FILE_NAME
30       "${CPACK_SOURCE_PACKAGE_FILE_NAME}-RC-${CMake_VERSION_RC}")
31   ENDIF(CMake_VERSION_RC)
32   IF(NOT DEFINED CPACK_SYSTEM_NAME)
33     SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
34   ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
35   IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
36     IF(CMAKE_CL_64)
37       SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
38     ELSE(CMAKE_CL_64)
39       SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
40     ENDIF(CMAKE_CL_64)
41   ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
42   IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
43     SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
44   ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
45   SET(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
46   IF(UNIX)
47     SET(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
48     SET(CPACK_SOURCE_STRIP_FILES "")
49     SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
50   ENDIF(UNIX)
51 # cygwin specific packaging stuff
52   IF(CYGWIN)
53     # if we are on cygwin and have cpack, then force the 
54     # doc, data and man dirs to conform to cygwin style directories
55     SET(CMAKE_DOC_DIR "/share/doc/${CPACK_PACKAGE_FILE_NAME}")
56     SET(CMAKE_DATA_DIR "/share/${CPACK_PACKAGE_FILE_NAME}")
57     SET(CMAKE_MAN_DIR "/share/man")
58     # let the user know we just forced these values
59     MESSAGE(STATUS "Setup for Cygwin packaging")
60     MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}")
61     MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}")
62     MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}")
63     
64     # setup the cygwin package name
65     SET(CPACK_PACKAGE_NAME cmake)
66     # setup the name of the package for cygwin cmake-2.4.3
67     SET(CPACK_PACKAGE_FILE_NAME
68       "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
69     # the source has the same name as the binary
70     SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
71     # Create a cygwin version number in case there are changes for cygwin
72     # that are not reflected upstream in CMake
73     SET(CPACK_CYGWIN_PATCH_NUMBER 1)
74     # These files are required by the cmCPackCygwinSourceGenerator and the files
75     # put into the release tar files.
76     SET(CPACK_CYGWIN_BUILD_SCRIPT 
77       "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh")
78     SET(CPACK_CYGWIN_PATCH_FILE 
79       "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch")
80     # include the sub directory cmake file for cygwin that
81     # configures some files and adds some install targets
82     # this file uses some of the package file name variables
83     INCLUDE(Utilities/Release/Cygwin/CMakeLists.txt)
84   ENDIF(CYGWIN)
85   # include CPack model once all variables are set
86   INCLUDE(CPack)
87 ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")