1
0

CPack.cmake 41 KB

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