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