1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 option(CMAKE_INSTALL_DEBUG_LIBRARIES
5 "Install Microsoft runtime debug libraries with CMake." FALSE)
6 mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES)
8 # By default, do not warn when built on machines using only VS Express:
9 if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
10 set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
13 if(CMake_INSTALL_DEPENDENCIES)
14 include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
17 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
18 set(CPACK_PACKAGE_VENDOR "Kitware")
19 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
20 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
21 set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
22 set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
23 set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
24 set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
25 set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE OFF)
27 # Installers for 32- vs. 64-bit CMake:
28 # - Root install directory (displayed to end user at installer-run time)
29 # - "NSIS package/display name" (text used in the installer GUI)
30 # - Registry key used to store info about the installation
32 set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
33 set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
35 set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
36 set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
38 set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
40 if(NOT DEFINED CPACK_SYSTEM_NAME)
41 # make sure package is not Cygwin-unknown, for Cygwin just
42 # cygwin is good for the system name
43 if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
44 set(CPACK_SYSTEM_NAME Cygwin)
46 set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
49 if(${CPACK_SYSTEM_NAME} MATCHES Windows)
51 set(CPACK_SYSTEM_NAME win64-x64)
52 set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
54 set(CPACK_SYSTEM_NAME win32-x86)
58 # Command for configure IFW script templates
59 include(${CMake_SOURCE_DIR}/Modules/CPackIFWConfigureFile.cmake)
61 # Advanced IFW configuration
62 set(_cpifwrc CPACK_IFW_COMPONENT_GROUP_CMAKE_)
63 set(_cpifwrcconf _CPACK_IFW_COMPONENT_GROUP_CMAKE)
64 set(${_cpifwrcconf} "# CMake IFW configuration\n")
65 macro(_cmifwarg DESCRIPTION TYPE NAME DEFAULT)
66 set(_var CMake_IFW_ROOT_COMPONENT_${NAME})
68 set(${_var} ${${_var}} CACHE ${TYPE} ${DESCRIPTION})
69 mark_as_advanced(${_var})
70 elseif(NOT "${DEFAULT}" STREQUAL "")
71 set(${_var} ${DEFAULT})
75 "${${_cpifwrcconf}} set(${_cpifwrc}${NAME}\n \"${${_var}}\")\n")
79 _cmifwarg("Package <Name> tag (domen-like)"
81 _cmifwarg("Package <DisplayName> tag"
82 STRING DISPLAY_NAME "")
83 _cmifwarg("Package <Description> tag"
84 STRING DESCRIPTION "")
85 _cmifwarg("Package <ReleaseDate> tag (keep empty to auto generate)"
86 STRING RELEASE_DATE "")
87 _cmifwarg("Package <Default> tag (values: TRUE, FALSE, SCRIPT)"
89 _cmifwarg("Package <Version> tag"
91 "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
92 _cmifwarg("Package <SortingPriority> tag"
93 STRING PRIORITY "100")
94 _cmifwarg("Package <ForsedInstallation> tag"
95 STRING FORCED_INSTALLATION "")
97 set(${_cpifwrc}LICENSES_DEFAULT
98 "${CPACK_PACKAGE_NAME} Copyright;${CPACK_RESOURCE_FILE_LICENSE}")
101 if(CMake_INSTALL_COMPONENTS)
102 set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
103 if(WIN32 AND NOT CYGWIN)
104 list(APPEND _CPACK_IFW_COMPONENTS_ALL cmcldeps)
106 if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
107 set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
108 ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
110 set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
112 list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
113 string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
114 _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
115 if(BUILD_CursesDialog)
116 list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
119 list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
121 set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES
122 \"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\")")
126 list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
129 list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
131 if(SPHINX_SINGLEHTML)
132 list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
135 list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
138 list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-latexpdf)
140 if(CMake_BUILD_DEVELOPER_REFERENCE)
141 if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
142 list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
144 if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
145 list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-qthelp)
148 set(_CPACK_IFW_COMPONENTS_CONFIGURATION "
150 set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
151 set(CPACK_COMPONENTS_GROUPING IGNORE)
153 _cmifwarg("Package <Script> template"
154 FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in")
156 if(BUILD_QtDialog AND USE_LGPL)
157 set(${_cpifwrc}LICENSES_DEFAULT
158 "${${_cpifwrc}LICENSES_DEFAULT};LGPLv${USE_LGPL};${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt")
160 _cmifwarg("Package <Script> template"
161 FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in")
163 _cmifwarg("Package <Script> generated"
164 FILEPATH SCRIPT_GENERATED "${CMake_BINARY_DIR}/CMake.qs")
166 _cmifwarg("Package <Licenses> tag (pairs of <display_name> <file_path>)"
167 STRING LICENSES "${${_cpifwrc}LICENSES_DEFAULT}")
169 if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
170 set(_CPACK_IFW_PACKAGE_ICON
171 "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
173 set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
176 set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
178 if(CMake_BUILD_DEVELOPER_REFERENCE)
179 if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
180 set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/developer-reference/html/index.html\", \"@StartMenuDir@/CMake Developer Reference.lnk\");\n")
183 install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
184 DESTINATION "${CMAKE_DOC_DIR}"
188 if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
189 set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
190 set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
193 # Components scripts configuration
194 if((EXISTS "${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}")
195 AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}" STREQUAL "")
196 AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT}"))
197 cpack_ifw_configure_file("${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}"
198 "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}")
199 _cmifwarg("Package <Script> tag"
200 FILEPATH SCRIPT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}")
204 CMake.Documentation.SphinxHTML
205 CMake.DeveloperReference.HTML)
206 cpack_ifw_configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
207 "${CMake_BINARY_DIR}/${_script}.qs")
210 if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
211 # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
212 # default to source package - system, on cygwin system is not
215 set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
217 set(CPACK_PACKAGE_FILE_NAME
218 "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
222 set(CPACK_PACKAGE_CONTACT "cmake+development@discourse.cmake.org")
225 set(CPACK_STRIP_FILES "${CMAKE_BIN_DIR}/ccmake;${CMAKE_BIN_DIR}/cmake;${CMAKE_BIN_DIR}/cpack;${CMAKE_BIN_DIR}/ctest")
226 set(CPACK_SOURCE_STRIP_FILES "")
227 set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
230 set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")
232 if(CMake_BUILD_WIX_CUSTOM_ACTION)
233 if(CMAKE_CONFIGURATION_TYPES)
234 set(CMake_BUILD_WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE)
236 set(CMake_BUILD_WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE)
240 # Set the options file that needs to be included inside CMakeCPackOptions.cmake
241 set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
242 configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
243 "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
244 set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
246 set(CPACK_SOURCE_IGNORE_FILES
247 # Files specific to version control.
249 "/\\\\.gitattributes$"
252 "/\\\\.hooks-config$"
254 # Cygwin package build.
264 if(CMake_CPACK_CUSTOM_SCRIPT)
265 include(${CMake_CPACK_CUSTOM_SCRIPT})
268 # include CPack model once all variables are set