STYLE: Nightly Date Stamp
[cmake.git] / CMakeCPack.cmake
blobec4cb9964f65774f1b96d2bbb998377bb80edbab
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     # make sure package is not Cygwin-unknown, for Cygwin just
36     # cygwin is good for the system name
37     IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
38       SET(CPACK_SYSTEM_NAME Cygwin)
39     ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
40       SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
41     ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
42   ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
43   IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
44     IF(CMAKE_CL_64)
45       SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
46     ELSE(CMAKE_CL_64)
47       SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
48     ENDIF(CMAKE_CL_64)
49   ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
50   IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
51     # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
52     # default to source package - system, on cygwin system is not 
53     # needed
54     IF(CYGWIN)
55       SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
56     ELSE(CYGWIN)
57       SET(CPACK_PACKAGE_FILE_NAME 
58         "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
59     ENDIF(CYGWIN)
60   ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
61   SET(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
62   IF(UNIX)
63     SET(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
64     SET(CPACK_SOURCE_STRIP_FILES "")
65     SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
66   ENDIF(UNIX)
67 # cygwin specific packaging stuff
68   IF(CYGWIN)
69     
70     # if we are on cygwin and have cpack, then force the 
71     # doc, data and man dirs to conform to cygwin style directories
72     SET(CMAKE_DOC_DIR "/share/doc/${CPACK_PACKAGE_FILE_NAME}")
73     SET(CMAKE_DATA_DIR "/share/${CPACK_PACKAGE_FILE_NAME}")
74     SET(CMAKE_MAN_DIR "/share/man")
75     # let the user know we just forced these values
76     MESSAGE(STATUS "Setup for Cygwin packaging")
77     MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}")
78     MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}")
79     MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}")
80     
81     # setup the cygwin package name
82     SET(CPACK_PACKAGE_NAME cmake)
83     # setup the name of the package for cygwin cmake-2.4.3
84     SET(CPACK_PACKAGE_FILE_NAME
85       "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
86     # the source has the same name as the binary
87     SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
88     # Create a cygwin version number in case there are changes for cygwin
89     # that are not reflected upstream in CMake
90     SET(CPACK_CYGWIN_PATCH_NUMBER 1)
91     # These files are required by the cmCPackCygwinSourceGenerator and the files
92     # put into the release tar files.
93     SET(CPACK_CYGWIN_BUILD_SCRIPT 
94       "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh")
95     SET(CPACK_CYGWIN_PATCH_FILE 
96       "${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch")
97     # include the sub directory cmake file for cygwin that
98     # configures some files and adds some install targets
99     # this file uses some of the package file name variables
100     INCLUDE(Utilities/Release/Cygwin/CMakeLists.txt)
101   ENDIF(CYGWIN)
102   # include CPack model once all variables are set
103   INCLUDE(CPack)
104 ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")