CPackComponent.cmake 22 KB

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