CPackComponent.cmake 20 KB

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