CPackComponent.cmake 21 KB

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