CPack.cmake 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  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. The contents of each of the components are identified by
  15. # the COMPONENT argument of CMake's INSTALL command. These components
  16. # can be annotated with user-friendly names and descriptions,
  17. # inter-component dependencies, etc., and grouped in various ways to
  18. # customize the resulting installer. See the cpack_add_* commands,
  19. # described below, for more information about component-specific
  20. # installations.
  21. #
  22. # The CPACK_GENERATOR variable has different meanings in different
  23. # contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
  24. # *list of generators*: when run with no other arguments, CPack
  25. # will iterate over that list and produce one package for each
  26. # generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR
  27. # is a *string naming a single generator*. If you need per-cpack-
  28. # generator logic to control *other* cpack settings, then you need
  29. # a CPACK_PROJECT_CONFIG_FILE.
  30. #
  31. # The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE.
  32. # See the top level file CMakeCPackOptions.cmake.in for an example.
  33. #
  34. # If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
  35. # on a per-generator basis. It only need contain overrides.
  36. #
  37. # Here's how it works:
  38. # - cpack runs
  39. # - it includes CPackConfig.cmake
  40. # - it iterates over the generators listed in that file's
  41. # CPACK_GENERATOR list variable (unless told to use just a
  42. # specific one via -G on the command line...)
  43. #
  44. # - foreach generator, it then
  45. # - sets CPACK_GENERATOR to the one currently being iterated
  46. # - includes the CPACK_PROJECT_CONFIG_FILE
  47. # - produces the package for that generator
  48. #
  49. # This is the key: For each generator listed in CPACK_GENERATOR
  50. # in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
  51. # internally to *the one currently being used* and then include
  52. # the CPACK_PROJECT_CONFIG_FILE.
  53. #
  54. # Before including this CPack module in your CMakeLists.txt file,
  55. # there are a variety of variables that can be set to customize
  56. # the resulting installers. The most commonly-used variables are:
  57. #
  58. # CPACK_PACKAGE_NAME - The name of the package (or application). If
  59. # not specified, defaults to the project name.
  60. #
  61. # CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g.,
  62. # "Kitware").
  63. #
  64. # CPACK_PACKAGE_VERSION_MAJOR - Package major Version
  65. #
  66. # CPACK_PACKAGE_VERSION_MINOR - Package minor Version
  67. #
  68. # CPACK_PACKAGE_VERSION_PATCH - Package patch Version
  69. #
  70. # CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
  71. # project. Used, for example, the introduction screen of a
  72. # CPack-generated Windows installer to describe the project.
  73. #
  74. # CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
  75. # project (only a few words).
  76. #
  77. # CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
  78. # not including the extension. For example, cmake-2.6.1-Linux-i686.
  79. #
  80. # CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
  81. # target system, e.g., "CMake 2.5".
  82. #
  83. # CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per
  84. # generator after setting CPACK_GENERATOR to the actual generator
  85. # being used. Allows per-generator setting of CPACK_* variables at
  86. # cpack time.
  87. #
  88. # CPACK_RESOURCE_FILE_LICENSE - License file for the project, which
  89. # will typically be displayed to the user (often with an explicit
  90. # "Accept" button, for graphical installers) prior to installation.
  91. #
  92. # CPACK_RESOURCE_FILE_README - ReadMe file for the project, which
  93. # typically describes in some detail
  94. #
  95. # CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which
  96. # welcomes users to this installer. Typically used in the graphical
  97. # installers on Windows and Mac OS X.
  98. #
  99. # CPACK_MONOLITHIC_INSTALL - Disables the component-based
  100. # installation mechanism, so that all components are always installed.
  101. #
  102. # CPACK_GENERATOR - List of CPack generators to use. If not
  103. # specified, CPack will create a set of options (e.g.,
  104. # CPACK_BINARY_NSIS) allowing the user to enable/disable individual
  105. # generators.
  106. #
  107. # CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file
  108. # for binary installers that will be generated by the CPack
  109. # module. Defaults to CPackConfig.cmake.
  110. #
  111. # CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along
  112. # with a text label, to be used to create Start Menu shortcuts on
  113. # Windows. For example, setting this to the list ccmake;CMake will
  114. # create a shortcut named "CMake" that will execute the installed
  115. # executable ccmake.
  116. #
  117. # CPACK_STRIP_FILES - List of files to be stripped. Starting with
  118. # CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
  119. # enables stripping of all files (a list of files evaluates to TRUE
  120. # in CMake, so this change is compatible).
  121. #
  122. # The following CPack variables are specific to source packages, and
  123. # will not affect binary packages:
  124. #
  125. # CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package,
  126. # e.g., cmake-2.6.1
  127. #
  128. # CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
  129. # will be stripped. Starting with CMake 2.6.0
  130. # CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
  131. # stripping of all files (a list of files evaluates to TRUE in CMake,
  132. # so this change is compatible).
  133. #
  134. # CPACK_SOURCE_GENERATOR - List of generators used for the source
  135. # packages. As with CPACK_GENERATOR, if this is not specified then
  136. # CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
  137. # allowing users to select which packages will be generated.
  138. #
  139. # CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack
  140. # configuration file for source installers that will be generated by
  141. # the CPack module. Defaults to CPackSourceConfig.cmake.
  142. #
  143. # CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
  144. # that won't be packaged when building a source package. This is a
  145. # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
  146. #
  147. # The following variables are specific to the DragNDrop installers
  148. # built on Mac OS X:
  149. #
  150. # CPACK_DMG_VOLUME_NAME - The volume name of the generated disk
  151. # image. Defaults to CPACK_PACKAGE_FILE_NAME.
  152. #
  153. # CPACK_DMG_FORMAT - The disk image format. Common values are UDRO
  154. # (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF
  155. # bzip2-compressed). Refer to hdiutil(1) for more information on
  156. # other available formats.
  157. #
  158. # CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g.
  159. # can be used to specify the Finder window position/geometry and
  160. # layout (such as hidden toolbars, placement of the icons etc.).
  161. # This file has to be generated by the Finder (either manually or
  162. # through OSA-script) using a normal folder from which the .DS_Store
  163. # file can then be extracted.
  164. #
  165. # CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be
  166. # used as the background for the Finder Window when the disk image
  167. # is opened. By default no background image is set. The background
  168. # image is applied after applying the custom .DS_Store file.
  169. #
  170. # CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to
  171. # operate on disk image files on Mac OS X. This variable can be used
  172. # to override the automatically detected command (or specify its
  173. # location if the auto-detection fails to find it.)
  174. #
  175. # CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set
  176. # extended attributes on files and directories on Mac OS X. This
  177. # variable can be used to override the automatically detected
  178. # command (or specify its location if the auto-detection fails to
  179. # find it.)
  180. #
  181. # CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile
  182. # resources on Mac OS X. This variable can be used to override the
  183. # automatically detected command (or specify its location if the
  184. # auto-detection fails to find it.)
  185. #
  186. # Installers built on Mac OS X using the Bundle generator use the
  187. # aforementioned DragNDrop variables, plus the following Bundle-specific
  188. # parameters:
  189. #
  190. # CPACK_BUNDLE_NAME - The name of the generated bundle. This
  191. # appears in the OSX finder as the bundle name. Required.
  192. #
  193. # CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used
  194. # as the Info.plist for the generated bundle. This assumes that
  195. # the caller has generated or specified their own Info.plist file.
  196. # Required.
  197. #
  198. # CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as
  199. # the icon for the generated bundle. This is the icon that appears
  200. # in the OSX finder for the bundle, and in the OSX dock when the
  201. # bundle is opened. Required.
  202. #
  203. # CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that
  204. # will be run whenever an end-user double-clicks the generated bundle
  205. # in the OSX Finder. Optional.
  206. #
  207. # The following variables are specific to the graphical installers built
  208. # on Windows using the Nullsoft Installation System.
  209. #
  210. # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
  211. # installing this project.
  212. #
  213. # CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated
  214. # install program.
  215. #
  216. # CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated
  217. # uninstall program.
  218. #
  219. # CPACK_PACKAGE_ICON - A branding image that will be displayed inside
  220. # the installer.
  221. #
  222. # CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will
  223. # be added to the install Section.
  224. #
  225. # CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will
  226. # be added to the uninstall Section.
  227. #
  228. # CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the
  229. # NSIS SetCompressor command.
  230. #
  231. # CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page
  232. # will appear in the installer that will allow the user to choose
  233. # whether the program directory should be added to the system PATH
  234. # variable.
  235. #
  236. # CPACK_NSIS_DISPLAY_NAME - The display name string that appears in
  237. # the Windows Add/Remove Program control panel
  238. #
  239. # CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the
  240. # installer.
  241. #
  242. # CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that
  243. # contains the installer icon.
  244. #
  245. # CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in
  246. # installing your application.
  247. #
  248. # CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more
  249. # information about your application.
  250. #
  251. # CPACK_NSIS_CONTACT - Contact information for questions and comments
  252. # about the installation process.
  253. #
  254. # CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for
  255. # creating start menu shortcuts.
  256. #
  257. # CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to
  258. # uninstall start menu shortcuts.
  259. #
  260. # The following variable is specific to installers build on Mac OS X
  261. # using PackageMaker:
  262. #
  263. # CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the
  264. # resulting PackageMaker archive should be compatible
  265. # with. Different versions of Mac OS X support different
  266. # features. For example, CPack can only build component-based
  267. # installers for Mac OS X 10.4 or newer, and can only build
  268. # installers that download component son-the-fly for Mac OS X 10.5
  269. # or newer. If left blank, this value will be set to the minimum
  270. # version of Mac OS X that supports the requested features. Set this
  271. # variable to some value (e.g., 10.4) only if you want to guarantee
  272. # that your installer will work on that version of Mac OS X, and
  273. # don't mind missing extra features available in the installer
  274. # shipping with later versions of Mac OS X.
  275. #
  276. # The following variables are for advanced uses of CPack:
  277. #
  278. # CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
  279. # project is CMake project. Defaults to the value of CMAKE_GENERATOR;
  280. # few users will want to change this setting.
  281. #
  282. # CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
  283. # what project to install. The four values are: Build directory,
  284. # Project Name, Project Component, Directory. If omitted, CPack will
  285. # build an installer that installers everything.
  286. #
  287. # CPACK_SYSTEM_NAME - System name, defaults to the value of
  288. # ${CMAKE_SYSTEM_NAME}.
  289. #
  290. # CPACK_PACKAGE_VERSION - Package full version, used internally. By
  291. # default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
  292. # CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
  293. #
  294. # CPACK_TOPLEVEL_TAG - Directory for the installed files.
  295. #
  296. # CPACK_INSTALL_COMMANDS - Extra commands to install components.
  297. #
  298. # CPACK_INSTALL_DIRECTORIES - Extra directories to install.
  299. #
  300. # Component-specific installation allows users to select specific sets
  301. # of components to install during the install process. Installation
  302. # components are identified by the COMPONENT argument of CMake's
  303. # INSTALL commands, and should be further described by the following
  304. # CPack commands:
  305. #
  306. # cpack_add_component - Describes a CPack installation component
  307. # named by the COMPONENT argument to a CMake INSTALL command.
  308. #
  309. # cpack_add_component(compname
  310. # [DISPLAY_NAME name]
  311. # [DESCRIPTION description]
  312. # [HIDDEN | REQUIRED | DISABLED ]
  313. # [GROUP group]
  314. # [DEPENDS comp1 comp2 ... ]
  315. # [INSTALL_TYPES type1 type2 ... ]
  316. # [DOWNLOADED]
  317. # [ARCHIVE_FILE filename])
  318. #
  319. # The cmake_add_component command describes an installation
  320. # component, which the user can opt to install or remove as part of
  321. # the graphical installation process. compname is the name of the
  322. # component, as provided to the COMPONENT argument of one or more
  323. # CMake INSTALL commands.
  324. #
  325. # DISPLAY_NAME is the displayed name of the component, used in
  326. # graphical installers to display the component name. This value can
  327. # be any string.
  328. #
  329. # DESCRIPTION is an extended description of the component, used in
  330. # graphical installers to give the user additional information about
  331. # the component. Descriptions can span multiple lines using "\n" as
  332. # the line separator. Typically, these descriptions should be no
  333. # more than a few lines long.
  334. #
  335. # HIDDEN indicates that this component will be hidden in the
  336. # graphical installer, so that the user cannot directly change
  337. # whether it is installed or not.
  338. #
  339. # REQUIRED indicates that this component is required, and therefore
  340. # will always be installed. It will be visible in the graphical
  341. # installer, but it cannot be unselected. (Typically, required
  342. # components are shown greyed out).
  343. #
  344. # DISABLED indicates that this component should be disabled
  345. # (unselected) by default. The user is free to select this component
  346. # for installation, unless it is also HIDDEN.
  347. #
  348. # DEPENDS lists the components on which this component depends. If
  349. # this component is selected, then each of the components listed
  350. # must also be selected. The dependency information is encoded
  351. # within the installer itself, so that users cannot install
  352. # inconsitent sets of components.
  353. #
  354. # GROUP names the component group of which this component is a
  355. # part. If not provided, the component will be a standalone
  356. # component, not part of any component group. Component groups are
  357. # described with the cpack_add_component_group command, detailed
  358. # below.
  359. #
  360. # INSTALL_TYPES lists the installation types of which this component
  361. # is a part. When one of these installations types is selected, this
  362. # component will automatically be selected. Installation types are
  363. # described with the cpack_add_install_type command, detailed below.
  364. #
  365. # DOWNLOADED indicates that this component should be downloaded
  366. # on-the-fly by the installer, rather than packaged in with the
  367. # installer itself. For more information, see the cpack_configure_downloads
  368. # command.
  369. #
  370. # ARCHIVE_FILE provides a name for the archive file created by CPack
  371. # to be used for downloaded components. If not supplied, CPack will
  372. # create a file with some name based on CPACK_PACKAGE_FILE_NAME and
  373. # the name of the component. See cpack_configure_downloads for more
  374. # information.
  375. #
  376. # cpack_add_component_group - Describes a group of related CPack
  377. # installation components.
  378. #
  379. # cpack_add_component_group(groupname
  380. # [DISPLAY_NAME name]
  381. # [DESCRIPTION description]
  382. # [PARENT_GROUP parent]
  383. # [EXPANDED]
  384. # [BOLD_TITLE])
  385. #
  386. # The cpack_add_component_group describes a group of installation
  387. # components, which will be placed together within the listing of
  388. # options. Typically, component groups allow the user to
  389. # select/deselect all of the components within a single group via a
  390. # single group-level option. Use component groups to reduce the
  391. # complexity of installers with many options. groupname is an
  392. # arbitrary name used to identify the group in the GROUP argument of
  393. # the cpack_add_component command, which is used to place a
  394. # component in a group. The name of the group must not conflict with
  395. # the name of any component.
  396. #
  397. # DISPLAY_NAME is the displayed name of the component group, used in
  398. # graphical installers to display the component group name. This
  399. # value can be any string.
  400. #
  401. # DESCRIPTION is an extended description of the component group,
  402. # used in graphical installers to give the user additional
  403. # information about the components within that group. Descriptions
  404. # can span multiple lines using "\n" as the line
  405. # separator. Typically, these descriptions should be no more than a
  406. # few lines long.
  407. #
  408. # PARENT_GROUP, if supplied, names the parent group of this group.
  409. # Parent groups are used to establish a hierarchy of groups,
  410. # providing an arbitrary hierarchy of groups.
  411. #
  412. # EXPANDED indicates that, by default, the group should show up as
  413. # "expanded", so that the user immediately sees all of the
  414. # components within the group. Otherwise, the group will initially
  415. # show up as a single entry.
  416. #
  417. # BOLD_TITLE indicates that the group title should appear in bold,
  418. # to call the user's attention to the group.
  419. #
  420. # cpack_add_install_type - Add a new installation type containing a
  421. # set of predefined component selections to the graphical installer.
  422. #
  423. # cpack_add_install_type(typename
  424. # [DISPLAY_NAME name])
  425. #
  426. # The cpack_add_install_type command identifies a set of preselected
  427. # components that represents a common use case for an
  428. # application. For example, a "Developer" install type might include
  429. # an application along with its header and library files, while an
  430. # "End user" install type might just include the application's
  431. # executable. Each component identifies itself with one or more
  432. # install types via the INSTALL_TYPES argument to
  433. # cpack_add_component.
  434. #
  435. # DISPLAY_NAME is the displayed name of the install type, which will
  436. # typically show up in a drop-down box within a graphical
  437. # installer. This value can be any string.
  438. #
  439. # cpack_configure_downloads - Configure CPack to download selected
  440. # components on-the-fly as part of the installation process.
  441. #
  442. # cpack_configure_downloads(site
  443. # [UPLOAD_DIRECTORY dirname]
  444. # [ALL]
  445. # [ADD_REMOVE|NO_ADD_REMOVE])
  446. #
  447. # The cpack_configure_downloads command configures installation-time
  448. # downloads of selected components. For each downloadable component,
  449. # CPack will create an archive containing the contents of that
  450. # component, which should be uploaded to the given site. When the
  451. # user selects that component for installation, the installer will
  452. # download and extract the component in place. This feature is
  453. # useful for creating small installers that only download the
  454. # requested components, saving bandwidth. Additionally, the
  455. # installers are small enough that they will be installed as part of
  456. # the normal installation process, and the "Change" button in
  457. # Windows Add/Remove Programs control panel will allow one to add or
  458. # remove parts of the application after the original
  459. # installation. On Windows, the downloaded-components functionality
  460. # requires the ZipDLL plug-in for NSIS, available at:
  461. #
  462. # http://nsis.sourceforge.net/ZipDLL_plug-in
  463. #
  464. # On Mac OS X, installers that download components on-the-fly can
  465. # only be built and installed on system using Mac OS X 10.5 or
  466. # later.
  467. #
  468. # The site argument is a URL where the archives for downloadable
  469. # components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/
  470. # All of the archives produced by CPack should be uploaded to that location.
  471. #
  472. # UPLOAD_DIRECTORY is the local directory where CPack will create the
  473. # various archives for each of the components. The contents of this
  474. # directory should be uploaded to a location accessible by the URL given
  475. # in the site argument. If omitted, CPack will use the directory
  476. # CPackUploads inside the CMake binary directory to store the generated
  477. # archives.
  478. #
  479. # The ALL flag indicates that all components be downloaded. Otherwise, only
  480. # those components explicitly marked as DOWNLOADED or that have a specified
  481. # ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies
  482. # ADD_REMOVE (unless NO_ADD_REMOVE is specified).
  483. #
  484. # ADD_REMOVE indicates that CPack should install a copy of the installer
  485. # that can be called from Windows' Add/Remove Programs dialog (via the
  486. # "Modify" button) to change the set of installed components. NO_ADD_REMOVE
  487. # turns off this behavior. This option is ignored on Mac OS X.
  488. #=============================================================================
  489. # Copyright 2006-2009 Kitware, Inc.
  490. #
  491. # Distributed under the OSI-approved BSD License (the "License");
  492. # see accompanying file Copyright.txt for details.
  493. #
  494. # This software is distributed WITHOUT ANY WARRANTY; without even the
  495. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  496. # See the License for more information.
  497. #=============================================================================
  498. # (To distribute this file outside of CMake, substitute the full
  499. # License text for the above reference.)
  500. # Pick a configuration file
  501. SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
  502. IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  503. SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  504. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  505. SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
  506. IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  507. SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  508. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  509. # Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments
  510. MACRO(cpack_parse_arguments prefix arg_names option_names)
  511. SET(${prefix}_DEFAULT_ARGS)
  512. FOREACH(arg_name ${arg_names})
  513. SET(${prefix}_${arg_name})
  514. ENDFOREACH(arg_name)
  515. FOREACH(option ${option_names})
  516. SET(${prefix}_${option} FALSE)
  517. ENDFOREACH(option)
  518. SET(current_arg_name DEFAULT_ARGS)
  519. SET(current_arg_list)
  520. FOREACH(arg ${ARGN})
  521. SET(larg_names ${arg_names})
  522. LIST(FIND larg_names "${arg}" is_arg_name)
  523. IF (is_arg_name GREATER -1)
  524. SET(${prefix}_${current_arg_name} ${current_arg_list})
  525. SET(current_arg_name ${arg})
  526. SET(current_arg_list)
  527. ELSE (is_arg_name GREATER -1)
  528. SET(loption_names ${option_names})
  529. LIST(FIND loption_names "${arg}" is_option)
  530. IF (is_option GREATER -1)
  531. SET(${prefix}_${arg} TRUE)
  532. ELSE (is_option GREATER -1)
  533. SET(current_arg_list ${current_arg_list} ${arg})
  534. ENDIF (is_option GREATER -1)
  535. ENDIF (is_arg_name GREATER -1)
  536. ENDFOREACH(arg)
  537. SET(${prefix}_${current_arg_name} ${current_arg_list})
  538. ENDMACRO(cpack_parse_arguments)
  539. # Macro that appends a SET command for the given variable name (var)
  540. # to the macro named strvar, but only if the variable named "var"
  541. # has been defined. The string will eventually be appended to a CPack
  542. # configuration file.
  543. MACRO(cpack_append_variable_set_command var strvar)
  544. IF (DEFINED ${var})
  545. SET(${strvar} "${${strvar}}SET(${var}")
  546. FOREACH(APPENDVAL ${${var}})
  547. SET(${strvar} "${${strvar}} ${APPENDVAL}")
  548. ENDFOREACH(APPENDVAL)
  549. SET(${strvar} "${${strvar}})\n")
  550. ENDIF (DEFINED ${var})
  551. ENDMACRO(cpack_append_variable_set_command)
  552. # Macro that appends a SET command for the given variable name (var)
  553. # to the macro named strvar, but only if the variable named "var"
  554. # has been defined and is a string. The string will eventually be
  555. # appended to a CPack configuration file.
  556. MACRO(cpack_append_string_variable_set_command var strvar)
  557. IF (DEFINED ${var})
  558. LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
  559. IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  560. SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n")
  561. ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  562. ENDIF (DEFINED ${var})
  563. ENDMACRO(cpack_append_string_variable_set_command)
  564. # Macro that appends a SET command for the given variable name (var)
  565. # to the macro named strvar, but only if the variable named "var"
  566. # has been set to true. The string will eventually be
  567. # appended to a CPack configuration file.
  568. MACRO(cpack_append_option_set_command var strvar)
  569. IF (${var})
  570. LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
  571. IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  572. SET(${strvar} "${${strvar}}SET(${var} TRUE)\n")
  573. ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  574. ENDIF (${var})
  575. ENDMACRO(cpack_append_option_set_command)
  576. # Macro that adds a component to the CPack installer
  577. MACRO(cpack_add_component compname)
  578. STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME)
  579. cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}
  580. "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE"
  581. "HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
  582. ${ARGN}
  583. )
  584. if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED)
  585. SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n")
  586. else ()
  587. SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
  588. endif ()
  589. IF(NOT CPACK_MONOLITHIC_INSTALL)
  590. # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the
  591. # value of CPACK_COMPONENTS_ALL in the configuration file. This will
  592. # take care of any components that have been added after the CPack
  593. # moduled was included.
  594. IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
  595. GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS)
  596. SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
  597. FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS})
  598. SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}")
  599. ENDFOREACH(COMP)
  600. SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n")
  601. ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
  602. ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
  603. cpack_append_string_variable_set_command(
  604. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME
  605. CPACK_ADDCOMP_STR)
  606. cpack_append_string_variable_set_command(
  607. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION
  608. CPACK_ADDCOMP_STR)
  609. cpack_append_variable_set_command(
  610. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP
  611. CPACK_ADDCOMP_STR)
  612. cpack_append_variable_set_command(
  613. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS
  614. CPACK_ADDCOMP_STR)
  615. cpack_append_variable_set_command(
  616. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES
  617. CPACK_ADDCOMP_STR)
  618. cpack_append_string_variable_set_command(
  619. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE
  620. CPACK_ADDCOMP_STR)
  621. cpack_append_option_set_command(
  622. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN
  623. CPACK_ADDCOMP_STR)
  624. cpack_append_option_set_command(
  625. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED
  626. CPACK_ADDCOMP_STR)
  627. cpack_append_option_set_command(
  628. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED
  629. CPACK_ADDCOMP_STR)
  630. cpack_append_option_set_command(
  631. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED
  632. CPACK_ADDCOMP_STR)
  633. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}")
  634. ENDMACRO(cpack_add_component)
  635. # Macro that adds a component group to the CPack installer
  636. MACRO(cpack_add_component_group grpname)
  637. STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME)
  638. cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}
  639. "DISPLAY_NAME;DESCRIPTION"
  640. "EXPANDED;BOLD_TITLE"
  641. ${ARGN}
  642. )
  643. SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n")
  644. cpack_append_string_variable_set_command(
  645. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME
  646. CPACK_ADDGRP_STR)
  647. cpack_append_string_variable_set_command(
  648. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
  649. CPACK_ADDGRP_STR)
  650. cpack_append_option_set_command(
  651. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
  652. CPACK_ADDGRP_STR)
  653. cpack_append_option_set_command(
  654. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE
  655. CPACK_ADDGRP_STR)
  656. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}")
  657. ENDMACRO(cpack_add_component_group)
  658. # Macro that adds an installation type to the CPack installer
  659. MACRO(cpack_add_install_type insttype)
  660. STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME)
  661. cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}
  662. "DISPLAY_NAME"
  663. ""
  664. ${ARGN}
  665. )
  666. SET(CPACK_INSTTYPE_STR
  667. "\n# Configuration for installation type \"${insttype}\"\n")
  668. SET(CPACK_INSTTYPE_STR
  669. "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
  670. cpack_append_string_variable_set_command(
  671. CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME
  672. CPACK_INSTTYPE_STR)
  673. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}")
  674. ENDMACRO(cpack_add_install_type)
  675. MACRO(cpack_configure_downloads site)
  676. cpack_parse_arguments(CPACK_DOWNLOAD
  677. "UPLOAD_DIRECTORY"
  678. "ALL;ADD_REMOVE;NO_ADD_REMOVE"
  679. ${ARGN}
  680. )
  681. SET(CPACK_CONFIG_DL_STR
  682. "\n# Downloaded components configuration\n")
  683. SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY})
  684. SET(CPACK_DOWNLOAD_SITE ${site})
  685. cpack_append_string_variable_set_command(
  686. CPACK_DOWNLOAD_SITE
  687. CPACK_CONFIG_DL_STR)
  688. cpack_append_string_variable_set_command(
  689. CPACK_UPLOAD_DIRECTORY
  690. CPACK_CONFIG_DL_STR)
  691. cpack_append_option_set_command(
  692. CPACK_DOWNLOAD_ALL
  693. CPACK_CONFIG_DL_STR)
  694. IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
  695. SET(CPACK_DOWNLOAD_ADD_REMOVE ON)
  696. ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
  697. SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE})
  698. cpack_append_option_set_command(
  699. CPACK_ADD_REMOVE
  700. CPACK_CONFIG_DL_STR)
  701. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}")
  702. ENDMACRO(cpack_configure_downloads)
  703. # Macro for setting values if a user did not overwrite them
  704. MACRO(cpack_set_if_not_set name value)
  705. IF(NOT DEFINED "${name}")
  706. SET(${name} "${value}")
  707. ENDIF(NOT DEFINED "${name}")
  708. ENDMACRO(cpack_set_if_not_set)
  709. # Macro to encode variables for the configuration file
  710. # find any varable that stars with CPACK and create a variable
  711. # _CPACK_OTHER_VARIABLES_ that contains SET commands for
  712. # each cpack variable. _CPACK_OTHER_VARIABLES_ is then
  713. # used as an @ replacment in configure_file for the CPackConfig.
  714. MACRO(cpack_encode_variables)
  715. SET(_CPACK_OTHER_VARIABLES_)
  716. GET_CMAKE_PROPERTY(res VARIABLES)
  717. FOREACH(var ${res})
  718. IF("xxx${var}" MATCHES "xxxCPACK")
  719. SET(_CPACK_OTHER_VARIABLES_
  720. "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
  721. ENDIF("xxx${var}" MATCHES "xxxCPACK")
  722. ENDFOREACH(var ${res})
  723. ENDMACRO(cpack_encode_variables)
  724. # Set the package name
  725. cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
  726. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
  727. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
  728. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
  729. cpack_set_if_not_set(CPACK_PACKAGE_VERSION
  730. "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
  731. cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
  732. cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
  733. "${CMAKE_PROJECT_NAME} built using CMake")
  734. cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
  735. "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
  736. cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
  737. "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
  738. cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
  739. "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
  740. cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
  741. "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
  742. cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
  743. IF(CPACK_NSIS_MODIFY_PATH)
  744. SET(CPACK_NSIS_MODIFY_PATH ON)
  745. ENDIF(CPACK_NSIS_MODIFY_PATH)
  746. SET(__cpack_system_name ${CMAKE_SYSTEM_NAME})
  747. IF(${__cpack_system_name} MATCHES Windows)
  748. IF(CMAKE_CL_64)
  749. SET(__cpack_system_name win64)
  750. ELSE(CMAKE_CL_64)
  751. SET(__cpack_system_name win32)
  752. ENDIF(CMAKE_CL_64)
  753. ENDIF(${__cpack_system_name} MATCHES Windows)
  754. cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
  755. # <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
  756. cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
  757. "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
  758. cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
  759. "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
  760. cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
  761. "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
  762. cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
  763. cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
  764. # always force to exactly "true" or "false" for CPack.Info.plist.in:
  765. if(CPACK_PACKAGE_RELOCATABLE)
  766. set(CPACK_PACKAGE_RELOCATABLE "true")
  767. else(CPACK_PACKAGE_RELOCATABLE)
  768. set(CPACK_PACKAGE_RELOCATABLE "false")
  769. endif(CPACK_PACKAGE_RELOCATABLE)
  770. macro(cpack_check_file_exists file description)
  771. if(NOT EXISTS "${file}")
  772. message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
  773. endif(NOT EXISTS "${file}")
  774. endmacro(cpack_check_file_exists)
  775. cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
  776. cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource")
  777. cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource")
  778. cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource")
  779. macro(cpack_optional_append _list _cond _item)
  780. if(${_cond})
  781. set(${_list} ${${_list}} ${_item})
  782. endif(${_cond})
  783. endmacro(cpack_optional_append _list _cond _item)
  784. # Provide options to choose generators
  785. # we might check here if the required tools for the generates exist
  786. # and set the defaults according to the results
  787. if(NOT CPACK_GENERATOR)
  788. if(UNIX)
  789. if(CYGWIN)
  790. option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
  791. else(CYGWIN)
  792. if(APPLE)
  793. option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
  794. option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
  795. option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON)
  796. option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
  797. else(APPLE)
  798. option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
  799. endif(APPLE)
  800. option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
  801. option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
  802. option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
  803. option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF)
  804. option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
  805. option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF)
  806. endif(CYGWIN)
  807. else(UNIX)
  808. option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
  809. option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
  810. endif(UNIX)
  811. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
  812. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
  813. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
  814. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
  815. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary)
  816. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB)
  817. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
  818. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
  819. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
  820. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
  821. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
  822. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
  823. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
  824. endif(NOT CPACK_GENERATOR)
  825. # Provide options to choose source generators
  826. if(NOT CPACK_SOURCE_GENERATOR)
  827. if(UNIX)
  828. if(CYGWIN)
  829. option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
  830. else(CYGWIN)
  831. option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
  832. option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON)
  833. option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON)
  834. option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
  835. endif(CYGWIN)
  836. else(UNIX)
  837. option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
  838. endif(UNIX)
  839. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource)
  840. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
  841. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2)
  842. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ)
  843. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
  844. endif(NOT CPACK_SOURCE_GENERATOR)
  845. # mark the above options as advanced
  846. mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
  847. CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
  848. CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
  849. CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
  850. CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
  851. CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
  852. # Set some other variables
  853. cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
  854. "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
  855. cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
  856. cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
  857. # if the user has set CPACK_NSIS_DISPLAY_NAME remember it
  858. if(DEFINED CPACK_NSIS_DISPLAY_NAME)
  859. SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
  860. endif()
  861. # if the user has set CPACK_NSIS_DISPLAY
  862. # explicitly, then use that as the default
  863. # value of CPACK_NSIS_PACKAGE_NAME instead
  864. # of CPACK_PACKAGE_INSTALL_DIRECTORY
  865. cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  866. if(CPACK_NSIS_DISPLAY_NAME_SET)
  867. string(REPLACE "\\" "\\\\"
  868. _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}")
  869. cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
  870. else()
  871. cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  872. endif()
  873. cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
  874. "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
  875. cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
  876. "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
  877. cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
  878. cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
  879. cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
  880. cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
  881. IF(DEFINED CPACK_COMPONENTS_ALL)
  882. IF(CPACK_MONOLITHIC_INSTALL)
  883. MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
  884. SET(CPACK_COMPONENTS_ALL)
  885. ELSE(CPACK_MONOLITHIC_INSTALL)
  886. # The user has provided the set of components to be installed as
  887. # part of a component-based installation; trust her.
  888. SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
  889. ENDIF(CPACK_MONOLITHIC_INSTALL)
  890. ELSE(DEFINED CPACK_COMPONENTS_ALL)
  891. # If the user has not specifically requested a monolithic installer
  892. # but has specified components in various "install" commands, tell
  893. # CPack about those components.
  894. IF(NOT CPACK_MONOLITHIC_INSTALL)
  895. GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS)
  896. LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
  897. IF(CPACK_COMPONENTS_LEN EQUAL 1)
  898. # Only one component: this is not a component-based installation
  899. # (at least, it isn't a component-based installation, but may
  900. # become one later if the user uses the cpack_add_* commands).
  901. SET(CPACK_COMPONENTS_ALL)
  902. ENDIF(CPACK_COMPONENTS_LEN EQUAL 1)
  903. SET(CPACK_COMPONENTS_LEN)
  904. ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
  905. ENDIF(DEFINED CPACK_COMPONENTS_ALL)
  906. # CMake always generates a component named "Unspecified", which is
  907. # used to install everything that doesn't have an explicitly-provided
  908. # component. Since these files should always be installed, we'll make
  909. # them hidden and required.
  910. set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
  911. set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
  912. cpack_encode_variables()
  913. configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
  914. # Generate source file
  915. cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
  916. "${CMAKE_SOURCE_DIR};/")
  917. cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
  918. cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
  919. "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
  920. cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
  921. "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
  922. SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
  923. SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
  924. SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
  925. SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
  926. SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
  927. SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
  928. SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
  929. cpack_encode_variables()
  930. configure_file("${cpack_source_input_file}"
  931. "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)