CPack.cmake 23 KB

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