CPackComponent.cmake 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. ##section Variables concerning CPack Components
  2. ##end
  3. ##module
  4. # - Build binary and source package installers
  5. #
  6. # The CPackComponent module is the module which handles
  7. # the component part of CPack. See CPack module for
  8. # general information about CPack.
  9. #
  10. # For certain kinds of binary installers (including the graphical
  11. # installers on Mac OS X and Windows), CPack generates installers that
  12. # allow users to select individual application components to
  13. # install. The contents of each of the components are identified by
  14. # the COMPONENT argument of CMake's INSTALL command. These components
  15. # can be annotated with user-friendly names and descriptions,
  16. # inter-component dependencies, etc., and grouped in various ways to
  17. # customize the resulting installer. See the cpack_add_* commands,
  18. # described below, for more information about component-specific
  19. # installations.
  20. #
  21. # Component-specific installation allows users to select specific sets
  22. # of components to install during the install process. Installation
  23. # components are identified by the COMPONENT argument of CMake's
  24. # INSTALL commands, and should be further described by the following
  25. # CPack commands:
  26. ##end
  27. #
  28. ##variable
  29. # CPACK_COMPONENTS_ALL - The list of component to install.
  30. #
  31. # The default value of this variable is computed by CPack
  32. # and contains all components defined by the project. The
  33. # user may set it to only include the specified components.
  34. ##end
  35. #
  36. ##variable
  37. # CPACK_<GENNAME>_COMPONENT_INSTALL - Enable/Disable component install for
  38. # CPack generator <GENNAME>.
  39. #
  40. # Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy
  41. # default behavior. e.g. RPM builds monolithic whereas NSIS builds component.
  42. # One can change the default behavior by setting this variable to 0/1 or OFF/ON.
  43. ##end
  44. ##variable
  45. # CPACK_COMPONENTS_GROUPING - Specify how components are grouped for multi-package
  46. # component-aware CPack generators.
  47. #
  48. # Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several
  49. # packages files when asked for component packaging. They group the component
  50. # differently depending on the value of this variable:
  51. # - ONE_PER_GROUP (default): creates one package file per component group
  52. # - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component
  53. # - IGNORE : creates one package per component, i.e. IGNORE component group
  54. # One can specify different grouping for different CPack generator by using
  55. # a CPACK_PROJECT_CONFIG_FILE.
  56. ##end
  57. ##variable
  58. # CPACK_COMPONENT_<compName>_DISPLAY_NAME - The name to be displayed for a component.
  59. ##end
  60. ##variable
  61. # CPACK_COMPONENT_<compName>_DESCRIPTION - The description of a component.
  62. ##end
  63. ##variable
  64. # CPACK_COMPONENT_<compName>_GROUP - The group of a component.
  65. ##end
  66. ##variable
  67. # CPACK_COMPONENT_<compName>_DEPENDS - The dependencies (list of components)
  68. # on which this component depends.
  69. ##end
  70. ##variable
  71. # CPACK_COMPONENT_<compName>_REQUIRED - True is this component is required.
  72. ##end
  73. ##macro
  74. # cpack_add_component - Describes a CPack installation component
  75. # named by the COMPONENT argument to a CMake INSTALL command.
  76. #
  77. # cpack_add_component(compname
  78. # [DISPLAY_NAME name]
  79. # [DESCRIPTION description]
  80. # [HIDDEN | REQUIRED | DISABLED ]
  81. # [GROUP group]
  82. # [DEPENDS comp1 comp2 ... ]
  83. # [INSTALL_TYPES type1 type2 ... ]
  84. # [DOWNLOADED]
  85. # [ARCHIVE_FILE filename])
  86. #
  87. # The cmake_add_component command describes an installation
  88. # component, which the user can opt to install or remove as part of
  89. # the graphical installation process. compname is the name of the
  90. # component, as provided to the COMPONENT argument of one or more
  91. # CMake INSTALL commands.
  92. #
  93. # DISPLAY_NAME is the displayed name of the component, used in
  94. # graphical installers to display the component name. This value can
  95. # be any string.
  96. #
  97. # DESCRIPTION is an extended description of the component, used in
  98. # graphical installers to give the user additional information about
  99. # the component. Descriptions can span multiple lines using "\n" as
  100. # the line separator. Typically, these descriptions should be no
  101. # more than a few lines long.
  102. #
  103. # HIDDEN indicates that this component will be hidden in the
  104. # graphical installer, so that the user cannot directly change
  105. # whether it is installed or not.
  106. #
  107. # REQUIRED indicates that this component is required, and therefore
  108. # will always be installed. It will be visible in the graphical
  109. # installer, but it cannot be unselected. (Typically, required
  110. # components are shown greyed out).
  111. #
  112. # DISABLED indicates that this component should be disabled
  113. # (unselected) by default. The user is free to select this component
  114. # for installation, unless it is also HIDDEN.
  115. #
  116. # DEPENDS lists the components on which this component depends. If
  117. # this component is selected, then each of the components listed
  118. # must also be selected. The dependency information is encoded
  119. # within the installer itself, so that users cannot install
  120. # inconsitent sets of components.
  121. #
  122. # GROUP names the component group of which this component is a
  123. # part. If not provided, the component will be a standalone
  124. # component, not part of any component group. Component groups are
  125. # described with the cpack_add_component_group command, detailed
  126. # below.
  127. #
  128. # INSTALL_TYPES lists the installation types of which this component
  129. # is a part. When one of these installations types is selected, this
  130. # component will automatically be selected. Installation types are
  131. # described with the cpack_add_install_type command, detailed below.
  132. #
  133. # DOWNLOADED indicates that this component should be downloaded
  134. # on-the-fly by the installer, rather than packaged in with the
  135. # installer itself. For more information, see the cpack_configure_downloads
  136. # command.
  137. #
  138. # ARCHIVE_FILE provides a name for the archive file created by CPack
  139. # to be used for downloaded components. If not supplied, CPack will
  140. # create a file with some name based on CPACK_PACKAGE_FILE_NAME and
  141. # the name of the component. See cpack_configure_downloads for more
  142. # information.
  143. ##end
  144. #
  145. ##macro
  146. # cpack_add_component_group - Describes a group of related CPack
  147. # installation components.
  148. #
  149. # cpack_add_component_group(groupname
  150. # [DISPLAY_NAME name]
  151. # [DESCRIPTION description]
  152. # [PARENT_GROUP parent]
  153. # [EXPANDED]
  154. # [BOLD_TITLE])
  155. #
  156. # The cpack_add_component_group describes a group of installation
  157. # components, which will be placed together within the listing of
  158. # options. Typically, component groups allow the user to
  159. # select/deselect all of the components within a single group via a
  160. # single group-level option. Use component groups to reduce the
  161. # complexity of installers with many options. groupname is an
  162. # arbitrary name used to identify the group in the GROUP argument of
  163. # the cpack_add_component command, which is used to place a
  164. # component in a group. The name of the group must not conflict with
  165. # the name of any component.
  166. #
  167. # DISPLAY_NAME is the displayed name of the component group, used in
  168. # graphical installers to display the component group name. This
  169. # value can be any string.
  170. #
  171. # DESCRIPTION is an extended description of the component group,
  172. # used in graphical installers to give the user additional
  173. # information about the components within that group. Descriptions
  174. # can span multiple lines using "\n" as the line
  175. # separator. Typically, these descriptions should be no more than a
  176. # few lines long.
  177. #
  178. # PARENT_GROUP, if supplied, names the parent group of this group.
  179. # Parent groups are used to establish a hierarchy of groups,
  180. # providing an arbitrary hierarchy of groups.
  181. #
  182. # EXPANDED indicates that, by default, the group should show up as
  183. # "expanded", so that the user immediately sees all of the
  184. # components within the group. Otherwise, the group will initially
  185. # show up as a single entry.
  186. #
  187. # BOLD_TITLE indicates that the group title should appear in bold,
  188. # to call the user's attention to the group.
  189. ##end
  190. #
  191. ##macro
  192. # cpack_add_install_type - Add a new installation type containing a
  193. # set of predefined component selections to the graphical installer.
  194. #
  195. # cpack_add_install_type(typename
  196. # [DISPLAY_NAME name])
  197. #
  198. # The cpack_add_install_type command identifies a set of preselected
  199. # components that represents a common use case for an
  200. # application. For example, a "Developer" install type might include
  201. # an application along with its header and library files, while an
  202. # "End user" install type might just include the application's
  203. # executable. Each component identifies itself with one or more
  204. # install types via the INSTALL_TYPES argument to
  205. # cpack_add_component.
  206. #
  207. # DISPLAY_NAME is the displayed name of the install type, which will
  208. # typically show up in a drop-down box within a graphical
  209. # installer. This value can be any string.
  210. ##end
  211. #
  212. ##macro
  213. # cpack_configure_downloads - Configure CPack to download selected
  214. # components on-the-fly as part of the installation process.
  215. #
  216. # cpack_configure_downloads(site
  217. # [UPLOAD_DIRECTORY dirname]
  218. # [ALL]
  219. # [ADD_REMOVE|NO_ADD_REMOVE])
  220. #
  221. # The cpack_configure_downloads command configures installation-time
  222. # downloads of selected components. For each downloadable component,
  223. # CPack will create an archive containing the contents of that
  224. # component, which should be uploaded to the given site. When the
  225. # user selects that component for installation, the installer will
  226. # download and extract the component in place. This feature is
  227. # useful for creating small installers that only download the
  228. # requested components, saving bandwidth. Additionally, the
  229. # installers are small enough that they will be installed as part of
  230. # the normal installation process, and the "Change" button in
  231. # Windows Add/Remove Programs control panel will allow one to add or
  232. # remove parts of the application after the original
  233. # installation. On Windows, the downloaded-components functionality
  234. # requires the ZipDLL plug-in for NSIS, available at:
  235. #
  236. # http://nsis.sourceforge.net/ZipDLL_plug-in
  237. #
  238. # On Mac OS X, installers that download components on-the-fly can
  239. # only be built and installed on system using Mac OS X 10.5 or
  240. # later.
  241. #
  242. # The site argument is a URL where the archives for downloadable
  243. # components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/
  244. # All of the archives produced by CPack should be uploaded to that location.
  245. #
  246. # UPLOAD_DIRECTORY is the local directory where CPack will create the
  247. # various archives for each of the components. The contents of this
  248. # directory should be uploaded to a location accessible by the URL given
  249. # in the site argument. If omitted, CPack will use the directory
  250. # CPackUploads inside the CMake binary directory to store the generated
  251. # archives.
  252. #
  253. # The ALL flag indicates that all components be downloaded. Otherwise, only
  254. # those components explicitly marked as DOWNLOADED or that have a specified
  255. # ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies
  256. # ADD_REMOVE (unless NO_ADD_REMOVE is specified).
  257. #
  258. # ADD_REMOVE indicates that CPack should install a copy of the installer
  259. # that can be called from Windows' Add/Remove Programs dialog (via the
  260. # "Modify" button) to change the set of installed components. NO_ADD_REMOVE
  261. # turns off this behavior. This option is ignored on Mac OS X.
  262. ##endmacro
  263. #=============================================================================
  264. # Copyright 2006-2009 Kitware, Inc.
  265. #
  266. # Distributed under the OSI-approved BSD License (the "License");
  267. # see accompanying file Copyright.txt for details.
  268. #
  269. # This software is distributed WITHOUT ANY WARRANTY; without even the
  270. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  271. # See the License for more information.
  272. #=============================================================================
  273. # (To distribute this file outside of CMake, substitute the full
  274. # License text for the above reference.)
  275. # Define var in order to avoid multiple inclusion
  276. IF(NOT CPackComponent_CMake_INCLUDED)
  277. SET(CPackComponent_CMake_INCLUDED 1)
  278. # Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments
  279. MACRO(cpack_parse_arguments prefix arg_names option_names)
  280. SET(${prefix}_DEFAULT_ARGS)
  281. FOREACH(arg_name ${arg_names})
  282. SET(${prefix}_${arg_name})
  283. ENDFOREACH(arg_name)
  284. FOREACH(option ${option_names})
  285. SET(${prefix}_${option} FALSE)
  286. ENDFOREACH(option)
  287. SET(current_arg_name DEFAULT_ARGS)
  288. SET(current_arg_list)
  289. FOREACH(arg ${ARGN})
  290. SET(larg_names ${arg_names})
  291. LIST(FIND larg_names "${arg}" is_arg_name)
  292. IF (is_arg_name GREATER -1)
  293. SET(${prefix}_${current_arg_name} ${current_arg_list})
  294. SET(current_arg_name ${arg})
  295. SET(current_arg_list)
  296. ELSE (is_arg_name GREATER -1)
  297. SET(loption_names ${option_names})
  298. LIST(FIND loption_names "${arg}" is_option)
  299. IF (is_option GREATER -1)
  300. SET(${prefix}_${arg} TRUE)
  301. ELSE (is_option GREATER -1)
  302. SET(current_arg_list ${current_arg_list} ${arg})
  303. ENDIF (is_option GREATER -1)
  304. ENDIF (is_arg_name GREATER -1)
  305. ENDFOREACH(arg)
  306. SET(${prefix}_${current_arg_name} ${current_arg_list})
  307. ENDMACRO(cpack_parse_arguments)
  308. # Macro that appends a SET command for the given variable name (var)
  309. # to the macro named strvar, but only if the variable named "var"
  310. # has been defined. The string will eventually be appended to a CPack
  311. # configuration file.
  312. MACRO(cpack_append_variable_set_command var strvar)
  313. IF (DEFINED ${var})
  314. SET(${strvar} "${${strvar}}SET(${var}")
  315. FOREACH(APPENDVAL ${${var}})
  316. SET(${strvar} "${${strvar}} ${APPENDVAL}")
  317. ENDFOREACH(APPENDVAL)
  318. SET(${strvar} "${${strvar}})\n")
  319. ENDIF (DEFINED ${var})
  320. ENDMACRO(cpack_append_variable_set_command)
  321. # Macro that appends a SET command for the given variable name (var)
  322. # to the macro named strvar, but only if the variable named "var"
  323. # has been defined and is a string. The string will eventually be
  324. # appended to a CPack configuration file.
  325. MACRO(cpack_append_string_variable_set_command var strvar)
  326. IF (DEFINED ${var})
  327. LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
  328. IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  329. SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n")
  330. ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  331. ENDIF (DEFINED ${var})
  332. ENDMACRO(cpack_append_string_variable_set_command)
  333. # Macro that appends a SET command for the given variable name (var)
  334. # to the macro named strvar, but only if the variable named "var"
  335. # has been set to true. The string will eventually be
  336. # appended to a CPack configuration file.
  337. MACRO(cpack_append_option_set_command var strvar)
  338. IF (${var})
  339. LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
  340. IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  341. SET(${strvar} "${${strvar}}SET(${var} TRUE)\n")
  342. ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
  343. ENDIF (${var})
  344. ENDMACRO(cpack_append_option_set_command)
  345. # Macro that adds a component to the CPack installer
  346. MACRO(cpack_add_component compname)
  347. STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME)
  348. cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}
  349. "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE"
  350. "HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
  351. ${ARGN}
  352. )
  353. if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED)
  354. SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n")
  355. else ()
  356. SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
  357. endif ()
  358. IF(NOT CPACK_MONOLITHIC_INSTALL)
  359. # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the
  360. # value of CPACK_COMPONENTS_ALL in the configuration file. This will
  361. # take care of any components that have been added after the CPack
  362. # moduled was included.
  363. IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
  364. GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS)
  365. SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
  366. FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS})
  367. SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}")
  368. ENDFOREACH(COMP)
  369. SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n")
  370. ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
  371. ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
  372. cpack_append_string_variable_set_command(
  373. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME
  374. CPACK_ADDCOMP_STR)
  375. cpack_append_string_variable_set_command(
  376. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION
  377. CPACK_ADDCOMP_STR)
  378. cpack_append_variable_set_command(
  379. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP
  380. CPACK_ADDCOMP_STR)
  381. cpack_append_variable_set_command(
  382. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS
  383. CPACK_ADDCOMP_STR)
  384. cpack_append_variable_set_command(
  385. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES
  386. CPACK_ADDCOMP_STR)
  387. cpack_append_string_variable_set_command(
  388. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE
  389. CPACK_ADDCOMP_STR)
  390. cpack_append_option_set_command(
  391. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN
  392. CPACK_ADDCOMP_STR)
  393. cpack_append_option_set_command(
  394. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED
  395. CPACK_ADDCOMP_STR)
  396. cpack_append_option_set_command(
  397. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED
  398. CPACK_ADDCOMP_STR)
  399. cpack_append_option_set_command(
  400. CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED
  401. CPACK_ADDCOMP_STR)
  402. # Backward compatibility issue.
  403. # Write to config iff the macros is used after CPack.cmake has been
  404. # included, other it's not necessary because the variables
  405. # will be encoded by cpack_encode_variables.
  406. IF(CPack_CMake_INCLUDED)
  407. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}")
  408. ENDIF(CPack_CMake_INCLUDED)
  409. ENDMACRO(cpack_add_component)
  410. # Macro that adds a component group to the CPack installer
  411. MACRO(cpack_add_component_group grpname)
  412. STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME)
  413. cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}
  414. "DISPLAY_NAME;DESCRIPTION"
  415. "EXPANDED;BOLD_TITLE"
  416. ${ARGN}
  417. )
  418. SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n")
  419. cpack_append_string_variable_set_command(
  420. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME
  421. CPACK_ADDGRP_STR)
  422. cpack_append_string_variable_set_command(
  423. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
  424. CPACK_ADDGRP_STR)
  425. cpack_append_option_set_command(
  426. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
  427. CPACK_ADDGRP_STR)
  428. cpack_append_option_set_command(
  429. CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE
  430. CPACK_ADDGRP_STR)
  431. # Backward compatibility issue.
  432. # Write to config iff the macros is used after CPack.cmake has been
  433. # included, other it's not necessary because the variables
  434. # will be encoded by cpack_encode_variables.
  435. IF(CPack_CMake_INCLUDED)
  436. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}")
  437. ENDIF(CPack_CMake_INCLUDED)
  438. ENDMACRO(cpack_add_component_group)
  439. # Macro that adds an installation type to the CPack installer
  440. MACRO(cpack_add_install_type insttype)
  441. STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME)
  442. cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}
  443. "DISPLAY_NAME"
  444. ""
  445. ${ARGN}
  446. )
  447. SET(CPACK_INSTTYPE_STR
  448. "\n# Configuration for installation type \"${insttype}\"\n")
  449. SET(CPACK_INSTTYPE_STR
  450. "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
  451. cpack_append_string_variable_set_command(
  452. CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME
  453. CPACK_INSTTYPE_STR)
  454. # Backward compatibility issue.
  455. # Write to config iff the macros is used after CPack.cmake has been
  456. # included, other it's not necessary because the variables
  457. # will be encoded by cpack_encode_variables.
  458. IF(CPack_CMake_INCLUDED)
  459. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}")
  460. ENDIF(CPack_CMake_INCLUDED)
  461. ENDMACRO(cpack_add_install_type)
  462. MACRO(cpack_configure_downloads site)
  463. cpack_parse_arguments(CPACK_DOWNLOAD
  464. "UPLOAD_DIRECTORY"
  465. "ALL;ADD_REMOVE;NO_ADD_REMOVE"
  466. ${ARGN}
  467. )
  468. SET(CPACK_CONFIG_DL_STR
  469. "\n# Downloaded components configuration\n")
  470. SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY})
  471. SET(CPACK_DOWNLOAD_SITE ${site})
  472. cpack_append_string_variable_set_command(
  473. CPACK_DOWNLOAD_SITE
  474. CPACK_CONFIG_DL_STR)
  475. cpack_append_string_variable_set_command(
  476. CPACK_UPLOAD_DIRECTORY
  477. CPACK_CONFIG_DL_STR)
  478. cpack_append_option_set_command(
  479. CPACK_DOWNLOAD_ALL
  480. CPACK_CONFIG_DL_STR)
  481. IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
  482. SET(CPACK_DOWNLOAD_ADD_REMOVE ON)
  483. ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
  484. SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE})
  485. cpack_append_option_set_command(
  486. CPACK_ADD_REMOVE
  487. CPACK_CONFIG_DL_STR)
  488. # Backward compatibility issue.
  489. # Write to config iff the macros is used after CPack.cmake has been
  490. # included, other it's not necessary because the variables
  491. # will be encoded by cpack_encode_variables.
  492. IF(CPack_CMake_INCLUDED)
  493. FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}")
  494. ENDIF(CPack_CMake_INCLUDED)
  495. ENDMACRO(cpack_configure_downloads)
  496. ENDIF(NOT CPackComponent_CMake_INCLUDED)