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