CPack.cmake 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. # - Build binary and source package installers
  2. #
  3. # The CPack module generates binary and source installers in a variety
  4. # of formats using the cpack program. Inclusion of the CPack module
  5. # adds two new targets to the resulting makefiles, package and
  6. # package_source, which build the binary and source installers,
  7. # respectively. The generated binary installers contain everything
  8. # installed via CMake's INSTALL command (and the deprecated
  9. # INSTALL_FILES, INSTALL_PROGRAMS, and INSTALL_TARGETS commands).
  10. #
  11. # For certain kinds of binary installers (including the graphical
  12. # installers on Mac OS X and Windows), CPack generates installers that
  13. # allow users to select individual application components to
  14. # install. See CPackComponent module for that.
  15. #
  16. # The CPACK_GENERATOR variable has different meanings in different
  17. # contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
  18. # *list of generators*: when run with no other arguments, CPack
  19. # will iterate over that list and produce one package for each
  20. # generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR
  21. # is a *string naming a single generator*. If you need per-cpack-
  22. # generator logic to control *other* cpack settings, then you need
  23. # a CPACK_PROJECT_CONFIG_FILE.
  24. #
  25. # The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE.
  26. # See the top level file CMakeCPackOptions.cmake.in for an example.
  27. #
  28. # If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
  29. # on a per-generator basis. It only need contain overrides.
  30. #
  31. # Here's how it works:
  32. # - cpack runs
  33. # - it includes CPackConfig.cmake
  34. # - it iterates over the generators listed in that file's
  35. # CPACK_GENERATOR list variable (unless told to use just a
  36. # specific one via -G on the command line...)
  37. #
  38. # - foreach generator, it then
  39. # - sets CPACK_GENERATOR to the one currently being iterated
  40. # - includes the CPACK_PROJECT_CONFIG_FILE
  41. # - produces the package for that generator
  42. #
  43. # This is the key: For each generator listed in CPACK_GENERATOR
  44. # in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
  45. # internally to *the one currently being used* and then include
  46. # the CPACK_PROJECT_CONFIG_FILE.
  47. #
  48. # Before including this CPack module in your CMakeLists.txt file,
  49. # there are a variety of variables that can be set to customize
  50. # the resulting installers. The most commonly-used variables are:
  51. #
  52. # CPACK_PACKAGE_NAME - The name of the package (or application). If
  53. # not specified, defaults to the project name.
  54. #
  55. # CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g.,
  56. # "Kitware").
  57. #
  58. # CPACK_PACKAGE_VERSION_MAJOR - Package major Version
  59. #
  60. # CPACK_PACKAGE_VERSION_MINOR - Package minor Version
  61. #
  62. # CPACK_PACKAGE_VERSION_PATCH - Package patch Version
  63. #
  64. # CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
  65. # project. Used, for example, the introduction screen of a
  66. # CPack-generated Windows installer to describe the project.
  67. #
  68. # CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
  69. # project (only a few words).
  70. #
  71. # CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
  72. # not including the extension. For example, cmake-2.6.1-Linux-i686.
  73. #
  74. # CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
  75. # target system, e.g., "CMake 2.5".
  76. #
  77. # CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per
  78. # generator after setting CPACK_GENERATOR to the actual generator
  79. # being used. Allows per-generator setting of CPACK_* variables at
  80. # cpack time.
  81. #
  82. # CPACK_RESOURCE_FILE_LICENSE - License file for the project, which
  83. # will typically be displayed to the user (often with an explicit
  84. # "Accept" button, for graphical installers) prior to installation.
  85. #
  86. # CPACK_RESOURCE_FILE_README - ReadMe file for the project, which
  87. # typically describes in some detail
  88. #
  89. # CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which
  90. # welcomes users to this installer. Typically used in the graphical
  91. # installers on Windows and Mac OS X.
  92. #
  93. # CPACK_MONOLITHIC_INSTALL - Disables the component-based
  94. # installation mechanism, so that all components are always installed.
  95. #
  96. # CPACK_GENERATOR - List of CPack generators to use. If not
  97. # specified, CPack will create a set of options (e.g.,
  98. # CPACK_BINARY_NSIS) allowing the user to enable/disable individual
  99. # generators.
  100. #
  101. # CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file
  102. # for binary installers that will be generated by the CPack
  103. # module. Defaults to CPackConfig.cmake.
  104. #
  105. # CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along
  106. # with a text label, to be used to create Start Menu shortcuts on
  107. # Windows. For example, setting this to the list ccmake;CMake will
  108. # create a shortcut named "CMake" that will execute the installed
  109. # executable ccmake.
  110. #
  111. # CPACK_STRIP_FILES - List of files to be stripped. Starting with
  112. # CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
  113. # enables stripping of all files (a list of files evaluates to TRUE
  114. # in CMake, so this change is compatible).
  115. #
  116. # The following CPack variables are specific to source packages, and
  117. # will not affect binary packages:
  118. #
  119. # CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package,
  120. # e.g., cmake-2.6.1
  121. #
  122. # CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
  123. # will be stripped. Starting with CMake 2.6.0
  124. # CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
  125. # stripping of all files (a list of files evaluates to TRUE in CMake,
  126. # so this change is compatible).
  127. #
  128. # CPACK_SOURCE_GENERATOR - List of generators used for the source
  129. # packages. As with CPACK_GENERATOR, if this is not specified then
  130. # CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
  131. # allowing users to select which packages will be generated.
  132. #
  133. # CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack
  134. # configuration file for source installers that will be generated by
  135. # the CPack module. Defaults to CPackSourceConfig.cmake.
  136. #
  137. # CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
  138. # that won't be packaged when building a source package. This is a
  139. # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
  140. #
  141. # The following variables are specific to the DragNDrop installers
  142. # built on Mac OS X:
  143. #
  144. # CPACK_DMG_VOLUME_NAME - The volume name of the generated disk
  145. # image. Defaults to CPACK_PACKAGE_FILE_NAME.
  146. #
  147. # CPACK_DMG_FORMAT - The disk image format. Common values are UDRO
  148. # (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF
  149. # bzip2-compressed). Refer to hdiutil(1) for more information on
  150. # other available formats.
  151. #
  152. # CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g.
  153. # can be used to specify the Finder window position/geometry and
  154. # layout (such as hidden toolbars, placement of the icons etc.).
  155. # This file has to be generated by the Finder (either manually or
  156. # through OSA-script) using a normal folder from which the .DS_Store
  157. # file can then be extracted.
  158. #
  159. # CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be
  160. # used as the background for the Finder Window when the disk image
  161. # is opened. By default no background image is set. The background
  162. # image is applied after applying the custom .DS_Store file.
  163. #
  164. # CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to
  165. # operate on disk image files on Mac OS X. This variable can be used
  166. # to override the automatically detected command (or specify its
  167. # location if the auto-detection fails to find it.)
  168. #
  169. # CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set
  170. # extended attributes on files and directories on Mac OS X. This
  171. # variable can be used to override the automatically detected
  172. # command (or specify its location if the auto-detection fails to
  173. # find it.)
  174. #
  175. # CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile
  176. # resources on Mac OS X. This variable can be used to override the
  177. # automatically detected command (or specify its location if the
  178. # auto-detection fails to find it.)
  179. #
  180. # The following variable is specific to installers build on Mac OS X
  181. # using PackageMaker:
  182. #
  183. # CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the
  184. # resulting PackageMaker archive should be compatible
  185. # with. Different versions of Mac OS X support different
  186. # features. For example, CPack can only build component-based
  187. # installers for Mac OS X 10.4 or newer, and can only build
  188. # installers that download component son-the-fly for Mac OS X 10.5
  189. # or newer. If left blank, this value will be set to the minimum
  190. # version of Mac OS X that supports the requested features. Set this
  191. # variable to some value (e.g., 10.4) only if you want to guarantee
  192. # that your installer will work on that version of Mac OS X, and
  193. # don't mind missing extra features available in the installer
  194. # shipping with later versions of Mac OS X.
  195. #
  196. # The following variables are for advanced uses of CPack:
  197. #
  198. # CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
  199. # project is CMake project. Defaults to the value of CMAKE_GENERATOR;
  200. # few users will want to change this setting.
  201. #
  202. # CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
  203. # what project to install. The four values are: Build directory,
  204. # Project Name, Project Component, Directory. If omitted, CPack will
  205. # build an installer that installers everything.
  206. #
  207. # CPACK_SYSTEM_NAME - System name, defaults to the value of
  208. # ${CMAKE_SYSTEM_NAME}.
  209. #
  210. # CPACK_PACKAGE_VERSION - Package full version, used internally. By
  211. # default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
  212. # CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
  213. #
  214. # CPACK_TOPLEVEL_TAG - Directory for the installed files.
  215. #
  216. # CPACK_INSTALL_COMMANDS - Extra commands to install components.
  217. #
  218. # CPACK_INSTALL_DIRECTORIES - Extra directories to install.
  219. #
  220. #=============================================================================
  221. # Copyright 2006-2009 Kitware, Inc.
  222. #
  223. # Distributed under the OSI-approved BSD License (the "License");
  224. # see accompanying file Copyright.txt for details.
  225. #
  226. # This software is distributed WITHOUT ANY WARRANTY; without even the
  227. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  228. # See the License for more information.
  229. #=============================================================================
  230. # (To distribute this file outside of CMake, substitute the full
  231. # License text for the above reference.)
  232. # Define this var in order to avoid (or warn) concerning multiple inclusion
  233. IF(CPack_CMake_INCLUDED)
  234. MESSAGE(WARNING "CPack.cmake has already been included!!")
  235. ELSE(CPack_CMake_INCLUDED)
  236. SET(CPack_CMake_INCLUDED 1)
  237. ENDIF(CPack_CMake_INCLUDED)
  238. # Pick a configuration file
  239. SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
  240. IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  241. SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  242. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  243. SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
  244. IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  245. SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  246. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  247. # Backward compatibility
  248. # Include CPackComponent macros if it has not already been included before.
  249. include(CPackComponent)
  250. # Macro for setting values if a user did not overwrite them
  251. MACRO(cpack_set_if_not_set name value)
  252. IF(NOT DEFINED "${name}")
  253. SET(${name} "${value}")
  254. ENDIF(NOT DEFINED "${name}")
  255. ENDMACRO(cpack_set_if_not_set)
  256. # Macro to encode variables for the configuration file
  257. # find any variable that starts with CPACK and create a variable
  258. # _CPACK_OTHER_VARIABLES_ that contains SET commands for
  259. # each cpack variable. _CPACK_OTHER_VARIABLES_ is then
  260. # used as an @ replacment in configure_file for the CPackConfig.
  261. MACRO(cpack_encode_variables)
  262. SET(_CPACK_OTHER_VARIABLES_)
  263. GET_CMAKE_PROPERTY(res VARIABLES)
  264. FOREACH(var ${res})
  265. IF("xxx${var}" MATCHES "xxxCPACK")
  266. SET(_CPACK_OTHER_VARIABLES_
  267. "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
  268. ENDIF("xxx${var}" MATCHES "xxxCPACK")
  269. ENDFOREACH(var ${res})
  270. ENDMACRO(cpack_encode_variables)
  271. # Set the package name
  272. cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
  273. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
  274. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
  275. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
  276. cpack_set_if_not_set(CPACK_PACKAGE_VERSION
  277. "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
  278. cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
  279. cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
  280. "${CMAKE_PROJECT_NAME} built using CMake")
  281. cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
  282. "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
  283. cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
  284. "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
  285. cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
  286. "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
  287. cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
  288. "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
  289. cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
  290. IF(CPACK_NSIS_MODIFY_PATH)
  291. SET(CPACK_NSIS_MODIFY_PATH ON)
  292. ENDIF(CPACK_NSIS_MODIFY_PATH)
  293. SET(__cpack_system_name ${CMAKE_SYSTEM_NAME})
  294. IF(${__cpack_system_name} MATCHES Windows)
  295. IF(CMAKE_CL_64)
  296. SET(__cpack_system_name win64)
  297. ELSE(CMAKE_CL_64)
  298. SET(__cpack_system_name win32)
  299. ENDIF(CMAKE_CL_64)
  300. ENDIF(${__cpack_system_name} MATCHES Windows)
  301. cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
  302. # Root dir: default value should be the string literal "$PROGRAMFILES"
  303. # for backwards compatibility. Projects may set this value to anything.
  304. set(__cpack_root_default "$PROGRAMFILES")
  305. cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
  306. # <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
  307. cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
  308. "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
  309. cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
  310. "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
  311. cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
  312. "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
  313. cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
  314. cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
  315. # always force to exactly "true" or "false" for CPack.Info.plist.in:
  316. if(CPACK_PACKAGE_RELOCATABLE)
  317. set(CPACK_PACKAGE_RELOCATABLE "true")
  318. else(CPACK_PACKAGE_RELOCATABLE)
  319. set(CPACK_PACKAGE_RELOCATABLE "false")
  320. endif(CPACK_PACKAGE_RELOCATABLE)
  321. macro(cpack_check_file_exists file description)
  322. if(NOT EXISTS "${file}")
  323. message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
  324. endif(NOT EXISTS "${file}")
  325. endmacro(cpack_check_file_exists)
  326. cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
  327. cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource")
  328. cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource")
  329. cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource")
  330. macro(cpack_optional_append _list _cond _item)
  331. if(${_cond})
  332. set(${_list} ${${_list}} ${_item})
  333. endif(${_cond})
  334. endmacro(cpack_optional_append _list _cond _item)
  335. # Provide options to choose generators
  336. # we might check here if the required tools for the generates exist
  337. # and set the defaults according to the results
  338. if(NOT CPACK_GENERATOR)
  339. if(UNIX)
  340. if(CYGWIN)
  341. option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
  342. else(CYGWIN)
  343. if(APPLE)
  344. option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
  345. option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
  346. option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON)
  347. option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
  348. else(APPLE)
  349. option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
  350. endif(APPLE)
  351. option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
  352. option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
  353. option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
  354. option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF)
  355. option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
  356. option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF)
  357. endif(CYGWIN)
  358. else(UNIX)
  359. option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
  360. option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
  361. endif(UNIX)
  362. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
  363. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
  364. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
  365. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
  366. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary)
  367. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB)
  368. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
  369. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
  370. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
  371. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
  372. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
  373. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
  374. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
  375. endif(NOT CPACK_GENERATOR)
  376. # Provide options to choose source generators
  377. if(NOT CPACK_SOURCE_GENERATOR)
  378. if(UNIX)
  379. if(CYGWIN)
  380. option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
  381. else(CYGWIN)
  382. option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
  383. option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON)
  384. option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON)
  385. option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
  386. endif(CYGWIN)
  387. else(UNIX)
  388. option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
  389. endif(UNIX)
  390. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource)
  391. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
  392. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2)
  393. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ)
  394. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
  395. endif(NOT CPACK_SOURCE_GENERATOR)
  396. # mark the above options as advanced
  397. mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
  398. CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
  399. CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
  400. CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
  401. CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
  402. CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
  403. # Set some other variables
  404. cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
  405. "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
  406. cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
  407. cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
  408. # if the user has set CPACK_NSIS_DISPLAY_NAME remember it
  409. if(DEFINED CPACK_NSIS_DISPLAY_NAME)
  410. SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
  411. endif()
  412. # if the user has set CPACK_NSIS_DISPLAY
  413. # explicitly, then use that as the default
  414. # value of CPACK_NSIS_PACKAGE_NAME instead
  415. # of CPACK_PACKAGE_INSTALL_DIRECTORY
  416. cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  417. if(CPACK_NSIS_DISPLAY_NAME_SET)
  418. string(REPLACE "\\" "\\\\"
  419. _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}")
  420. cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
  421. else()
  422. cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  423. endif()
  424. cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
  425. "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
  426. cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
  427. "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
  428. cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
  429. cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
  430. cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
  431. cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
  432. IF(DEFINED CPACK_COMPONENTS_ALL)
  433. IF(CPACK_MONOLITHIC_INSTALL)
  434. MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
  435. SET(CPACK_COMPONENTS_ALL)
  436. ELSE(CPACK_MONOLITHIC_INSTALL)
  437. # The user has provided the set of components to be installed as
  438. # part of a component-based installation; trust her.
  439. SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
  440. ENDIF(CPACK_MONOLITHIC_INSTALL)
  441. ELSE(DEFINED CPACK_COMPONENTS_ALL)
  442. # If the user has not specifically requested a monolithic installer
  443. # but has specified components in various "install" commands, tell
  444. # CPack about those components.
  445. IF(NOT CPACK_MONOLITHIC_INSTALL)
  446. GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS)
  447. LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
  448. IF(CPACK_COMPONENTS_LEN EQUAL 1)
  449. # Only one component: this is not a component-based installation
  450. # (at least, it isn't a component-based installation, but may
  451. # become one later if the user uses the cpack_add_* commands).
  452. SET(CPACK_COMPONENTS_ALL)
  453. ENDIF(CPACK_COMPONENTS_LEN EQUAL 1)
  454. SET(CPACK_COMPONENTS_LEN)
  455. ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
  456. ENDIF(DEFINED CPACK_COMPONENTS_ALL)
  457. # CMake always generates a component named "Unspecified", which is
  458. # used to install everything that doesn't have an explicitly-provided
  459. # component. Since these files should always be installed, we'll make
  460. # them hidden and required.
  461. set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
  462. set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
  463. cpack_encode_variables()
  464. configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
  465. # Generate source file
  466. cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
  467. "${CMAKE_SOURCE_DIR};/")
  468. cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
  469. cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
  470. "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
  471. cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
  472. "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
  473. SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
  474. SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
  475. SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
  476. SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
  477. SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
  478. SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
  479. SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
  480. cpack_encode_variables()
  481. configure_file("${cpack_source_input_file}"
  482. "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)