CPackIFW.cmake 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. #.rst:
  2. # CPackIFW
  3. # --------
  4. #
  5. # .. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html
  6. #
  7. # This module looks for the location of the command line utilities supplied
  8. # with the Qt Installer Framework (QtIFW_).
  9. #
  10. # The module also defines several commands to control the behavior of the
  11. # CPack ``IFW`` generator.
  12. #
  13. #
  14. # Overview
  15. # ^^^^^^^^
  16. #
  17. # CPack ``IFW`` generator helps you to create online and offline
  18. # binary cross-platform installers with a graphical user interface.
  19. #
  20. # CPack IFW generator prepares project installation and generates configuration
  21. # and meta information for QtIFW_ tools.
  22. #
  23. # The QtIFW_ provides a set of tools and utilities to create
  24. # installers for the supported desktop Qt platforms: Linux, Microsoft Windows,
  25. # and Mac OS X.
  26. #
  27. # You should also install QtIFW_ to use CPack ``IFW`` generator.
  28. # If you don't use a default path for the installation, please set
  29. # the used path in the variable ``QTIFWDIR``.
  30. #
  31. # Variables
  32. # ^^^^^^^^^
  33. #
  34. # You can use the following variables to change behavior of CPack ``IFW``
  35. # generator.
  36. #
  37. # Debug
  38. # """"""
  39. #
  40. # .. variable:: CPACK_IFW_VERBOSE
  41. #
  42. # Set to ``ON`` to enable addition debug output.
  43. # By default is ``OFF``.
  44. #
  45. # Package
  46. # """""""
  47. #
  48. # .. variable:: CPACK_IFW_PACKAGE_TITLE
  49. #
  50. # Name of the installer as displayed on the title bar.
  51. # By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`.
  52. #
  53. # .. variable:: CPACK_IFW_PACKAGE_PUBLISHER
  54. #
  55. # Publisher of the software (as shown in the Windows Control Panel).
  56. # By default used :variable:`CPACK_PACKAGE_VENDOR`.
  57. #
  58. # .. variable:: CPACK_IFW_PRODUCT_URL
  59. #
  60. # URL to a page that contains product information on your web site.
  61. #
  62. # .. variable:: CPACK_IFW_PACKAGE_ICON
  63. #
  64. # Filename for a custom installer icon. The actual file is '.icns' (Mac OS X),
  65. # '.ico' (Windows). No functionality on Unix.
  66. #
  67. # .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
  68. #
  69. # Filename for a custom window icon in PNG format for the Installer
  70. # application.
  71. #
  72. # .. variable:: CPACK_IFW_PACKAGE_LOGO
  73. #
  74. # Filename for a logo is used as QWizard::LogoPixmap.
  75. #
  76. # .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY
  77. #
  78. # Name of the default program group for the product in the Windows Start menu.
  79. #
  80. # By default used :variable:`CPACK_IFW_PACKAGE_NAME`.
  81. #
  82. # .. variable:: CPACK_IFW_TARGET_DIRECTORY
  83. #
  84. # Default target directory for installation.
  85. # By default used
  86. # "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
  87. #
  88. # You can use predefined variables.
  89. #
  90. # .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY
  91. #
  92. # Default target directory for installation with administrator rights.
  93. #
  94. # You can use predefined variables.
  95. #
  96. # .. variable:: CPACK_IFW_PACKAGE_GROUP
  97. #
  98. # The group, which will be used to configure the root package
  99. #
  100. # .. variable:: CPACK_IFW_PACKAGE_NAME
  101. #
  102. # The root package name, which will be used if configuration group is not
  103. # specified
  104. #
  105. # .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME
  106. #
  107. # Filename of the generated maintenance tool.
  108. # The platform-specific executable file extension is appended.
  109. #
  110. # By default used QtIFW_ defaults (``maintenancetool``).
  111. #
  112. # .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
  113. #
  114. # Filename for the configuration of the generated maintenance tool.
  115. #
  116. # By default used QtIFW_ defaults (``maintenancetool.ini``).
  117. #
  118. # .. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS
  119. #
  120. # Set to ``ON`` if the installation path can contain non-ASCII characters.
  121. #
  122. # Is ``ON`` for QtIFW_ less 2.0 tools.
  123. #
  124. # .. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH
  125. #
  126. # Set to ``OFF`` if the installation path cannot contain space characters.
  127. #
  128. # Is ``ON`` for QtIFW_ less 2.0 tools.
  129. #
  130. # .. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT
  131. #
  132. # Filename for a custom installer control script.
  133. #
  134. # .. variable:: CPACK_IFW_REPOSITORIES_ALL
  135. #
  136. # The list of remote repositories.
  137. #
  138. # The default value of this variable is computed by CPack and contains
  139. # all repositories added with command :command:`cpack_ifw_add_repository`
  140. # or updated with command :command:`cpack_ifw_update_repository`.
  141. #
  142. # .. variable:: CPACK_IFW_DOWNLOAD_ALL
  143. #
  144. # If this is ``ON`` all components will be downloaded.
  145. # By default is ``OFF`` or used value
  146. # from ``CPACK_DOWNLOAD_ALL`` if set
  147. #
  148. # Components
  149. # """"""""""
  150. #
  151. # .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES
  152. #
  153. # Resolve duplicate names when installing components with groups.
  154. #
  155. # .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES
  156. #
  157. # Additional prepared packages dirs that will be used to resolve
  158. # dependent components.
  159. #
  160. # Tools
  161. # """"""""
  162. #
  163. # .. variable:: CPACK_IFW_FRAMEWORK_VERSION
  164. #
  165. # The version of used QtIFW_ tools.
  166. #
  167. # .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
  168. #
  169. # The path to "binarycreator" command line client.
  170. #
  171. # This variable is cached and can be configured user if need.
  172. #
  173. # .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
  174. #
  175. # The path to "repogen" command line client.
  176. #
  177. # This variable is cached and can be configured user if need.
  178. #
  179. # Commands
  180. # ^^^^^^^^^
  181. #
  182. # The module defines the following commands:
  183. #
  184. # --------------------------------------------------------------------------
  185. #
  186. # .. command:: cpack_ifw_configure_component
  187. #
  188. # Sets the arguments specific to the CPack IFW generator.
  189. #
  190. # ::
  191. #
  192. # cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL]
  193. # [NAME <name>]
  194. # [VERSION <version>]
  195. # [SCRIPT <script>]
  196. # [PRIORITY <priority>]
  197. # [DEPENDS <com_id> ...]
  198. # [LICENSES <display_name> <file_path> ...])
  199. #
  200. # This command should be called after :command:`cpack_add_component` command.
  201. #
  202. # ``COMMON`` if set, then the component will be packaged and installed as part
  203. # of a group to which it belongs.
  204. #
  205. # ``ESSENTIAL`` if set, then the package manager stays disabled until that
  206. # component is updated.
  207. #
  208. # ``NAME`` is used to create domain-like identification for this component.
  209. # By default used origin component name.
  210. #
  211. # ``VERSION`` is version of component.
  212. # By default used :variable:`CPACK_PACKAGE_VERSION`.
  213. #
  214. # ``SCRIPT`` is a relative or absolute path to operations script
  215. # for this component.
  216. #
  217. # ``PRIORITY`` is priority of the component in the tree.
  218. #
  219. # ``DEPENDS`` list of dependency component identifiers in QtIFW_ style.
  220. #
  221. # ``LICENSES`` pair of <display_name> and <file_path> of license text for this
  222. # component. You can specify more then one license.
  223. #
  224. # --------------------------------------------------------------------------
  225. #
  226. # .. command:: cpack_ifw_configure_component_group
  227. #
  228. # Sets the arguments specific to the CPack IFW generator.
  229. #
  230. # ::
  231. #
  232. # cpack_ifw_configure_component_group(<groupname>
  233. # [NAME <name>]
  234. # [VERSION <version>]
  235. # [SCRIPT <script>]
  236. # [PRIORITY <priority>]
  237. # [LICENSES <display_name> <file_path> ...])
  238. #
  239. # This command should be called after :command:`cpack_add_component_group`
  240. # command.
  241. #
  242. # ``NAME`` is used to create domain-like identification for this component
  243. # group.
  244. # By default used origin component group name.
  245. #
  246. # ``VERSION`` is version of component group.
  247. # By default used :variable:`CPACK_PACKAGE_VERSION`.
  248. #
  249. # ``SCRIPT`` is a relative or absolute path to operations script
  250. # for this component group.
  251. #
  252. # ``PRIORITY`` is priority of the component group in the tree.
  253. #
  254. # ``LICENSES`` pair of <display_name> and <file_path> of license text for this
  255. # component group. You can specify more then one license.
  256. #
  257. # --------------------------------------------------------------------------
  258. #
  259. # .. command:: cpack_ifw_add_repository
  260. #
  261. # Add QtIFW_ specific remote repository to binary installer.
  262. #
  263. # ::
  264. #
  265. # cpack_ifw_add_repository(<reponame> [DISABLED]
  266. # URL <url>
  267. # [USERNAME <username>]
  268. # [PASSWORD <password>]
  269. # [DISPLAY_NAME <display_name>])
  270. #
  271. # This command will also add the <reponame> repository
  272. # to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
  273. #
  274. # ``DISABLED`` if set, then the repository will be disabled by default.
  275. #
  276. # ``URL`` is points to a list of available components.
  277. #
  278. # ``USERNAME`` is used as user on a protected repository.
  279. #
  280. # ``PASSWORD`` is password to use on a protected repository.
  281. #
  282. # ``DISPLAY_NAME`` is string to display instead of the URL.
  283. #
  284. #
  285. # --------------------------------------------------------------------------
  286. #
  287. # .. command:: cpack_ifw_update_repository
  288. #
  289. # Update QtIFW_ specific repository from remote repository.
  290. #
  291. # ::
  292. #
  293. # cpack_ifw_update_repository(<reponame>
  294. # [[ADD|REMOVE] URL <url>]|
  295. # [REPLACE OLD_URL <old_url> NEW_URL <new_url>]]
  296. # [USERNAME <username>]
  297. # [PASSWORD <password>]
  298. # [DISPLAY_NAME <display_name>])
  299. #
  300. # This command will also add the <reponame> repository
  301. # to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
  302. #
  303. # ``URL`` is points to a list of available components.
  304. #
  305. # ``OLD_URL`` is points to a list that will replaced.
  306. #
  307. # ``NEW_URL`` is points to a list that will replace to.
  308. #
  309. # ``USERNAME`` is used as user on a protected repository.
  310. #
  311. # ``PASSWORD`` is password to use on a protected repository.
  312. #
  313. # ``DISPLAY_NAME`` is string to display instead of the URL.
  314. #
  315. # Example usage
  316. # ^^^^^^^^^^^^^
  317. #
  318. # .. code-block:: cmake
  319. #
  320. # set(CPACK_PACKAGE_NAME "MyPackage")
  321. # set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
  322. # set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer
  323. #
  324. # include(CPack)
  325. # include(CPackIFW)
  326. #
  327. # cpack_add_component(myapp
  328. # DISPLAY_NAME "MyApp"
  329. # DESCRIPTION "My Application")
  330. # cpack_ifw_configure_component(myapp
  331. # VERSION "1.2.3" # Version of component
  332. # SCRIPT "operations.qs")
  333. # cpack_add_component(mybigplugin
  334. # DISPLAY_NAME "MyBigPlugin"
  335. # DESCRIPTION "My Big Downloadable Plugin"
  336. # DOWNLOADED)
  337. # cpack_ifw_add_repository(myrepo
  338. # URL "http://example.com/ifw/repo/myapp"
  339. # DISPLAY_NAME "My Application Repository")
  340. #
  341. #
  342. # Online installer
  343. # ^^^^^^^^^^^^^^^^
  344. #
  345. # By default CPack IFW generator makes offline installer. This means that all
  346. # components will be packaged into a binary file.
  347. #
  348. # To make a component downloaded, you must set the ``DOWNLOADED`` option in
  349. # :command:`cpack_add_component`.
  350. #
  351. # Then you would use the command :command:`cpack_configure_downloads`.
  352. # If you set ``ALL`` option all components will be downloaded.
  353. #
  354. # You also can use command :command:`cpack_ifw_add_repository` and
  355. # variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
  356. #
  357. # CPack IFW generator creates "repository" dir in current binary dir. You
  358. # would copy content of this dir to specified ``site`` (``url``).
  359. #
  360. # See Also
  361. # ^^^^^^^^
  362. #
  363. # Qt Installer Framework Manual:
  364. #
  365. # Index page
  366. # http://doc.qt.io/qtinstallerframework/index.html
  367. #
  368. # Component Scripting
  369. # http://doc.qt.io/qtinstallerframework/scripting.html
  370. #
  371. # Predefined Variables
  372. # http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables
  373. #
  374. # Promoting Updates
  375. # http://doc.qt.io/qtinstallerframework/ifw-updates.html
  376. #
  377. # Download Qt Installer Framework for you platform from Qt site:
  378. # http://download.qt.io/official_releases/qt-installer-framework
  379. #
  380. #=============================================================================
  381. # Copyright 2014 Kitware, Inc.
  382. # Copyright 2014 Konstantin Podsvirov <konstantin@podsvirov.pro>
  383. #
  384. # Distributed under the OSI-approved BSD License (the "License");
  385. # see accompanying file Copyright.txt for details.
  386. #
  387. # This software is distributed WITHOUT ANY WARRANTY; without even the
  388. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  389. # See the License for more information.
  390. #=============================================================================
  391. # (To distribute this file outside of CMake, substitute the full
  392. # License text for the above reference.)
  393. #=============================================================================
  394. # Search Qt Installer Framework tools
  395. #=============================================================================
  396. # Default path
  397. set(_CPACK_IFW_PATHS
  398. "${QTIFWDIR}"
  399. "$ENV{QTIFWDIR}"
  400. "${QTDIR}"
  401. "$ENV{QTIFWDIR}")
  402. if(WIN32)
  403. list(APPEND _CPACK_IFW_PATHS
  404. "$ENV{HOMEDRIVE}/Qt"
  405. "C:/Qt")
  406. else()
  407. list(APPEND _CPACK_IFW_PATHS
  408. "$ENV{HOME}/Qt"
  409. "/opt/Qt")
  410. endif()
  411. set(_CPACK_IFW_SUFFIXES
  412. # Common
  413. "bin"
  414. # Second branch
  415. "QtIFW2.3.0/bin"
  416. "QtIFW2.2.0/bin"
  417. "QtIFW2.1.0/bin"
  418. "QtIFW2.0.3/bin"
  419. "QtIFW2.0.1/bin"
  420. "QtIFW2.0.0/bin"
  421. # First branch
  422. "QtIFW-1.6.0/bin"
  423. "QtIFW-1.5.0/bin"
  424. "QtIFW-1.4.0/bin"
  425. "QtIFW-1.3.0/bin")
  426. # Look for 'binarycreator'
  427. find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
  428. NAMES binarycreator
  429. PATHS ${_CPACK_IFW_PATHS}
  430. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  431. DOC "QtIFW binarycreator command line client")
  432. mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
  433. # Look for 'repogen'
  434. find_program(CPACK_IFW_REPOGEN_EXECUTABLE
  435. NAMES repogen
  436. PATHS ${_CPACK_IFW_PATHS}
  437. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  438. DOC "QtIFW repogen command line client"
  439. )
  440. mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
  441. # Look for 'installerbase'
  442. find_program(CPACK_IFW_INSTALLERBASE_EXECUTABLE
  443. NAMES installerbase
  444. PATHS ${_CPACK_IFW_PATHS}
  445. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  446. DOC "QtIFW installer executable base"
  447. )
  448. mark_as_advanced(CPACK_IFW_INSTALLERBASE_EXECUTABLE)
  449. # Look for 'devtool' (appeared in the second branch)
  450. find_program(CPACK_IFW_DEVTOOL_EXECUTABLE
  451. NAMES devtool
  452. PATHS ${_CPACK_IFW_PATHS}
  453. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  454. DOC "QtIFW devtool command line client"
  455. )
  456. mark_as_advanced(CPACK_IFW_DEVTOOL_EXECUTABLE)
  457. #
  458. ## Next code is included only once
  459. #
  460. if(NOT CPackIFW_CMake_INCLUDED)
  461. set(CPackIFW_CMake_INCLUDED 1)
  462. #=============================================================================
  463. # Framework version
  464. #=============================================================================
  465. if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND CPACK_IFW_DEVTOOL_EXECUTABLE)
  466. execute_process(COMMAND
  467. "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}" --framework-version
  468. OUTPUT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION)
  469. if(CPACK_IFW_FRAMEWORK_VERSION)
  470. string(REPLACE " " ""
  471. CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}")
  472. string(REPLACE "\t" ""
  473. CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}")
  474. string(REPLACE "\n" ""
  475. CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}")
  476. if(CPACK_IFW_VERBOSE)
  477. message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} version")
  478. endif()
  479. endif()
  480. endif()
  481. #=============================================================================
  482. # Macro definition
  483. #=============================================================================
  484. # Macro definition based on CPackComponent
  485. if(NOT CPackComponent_CMake_INCLUDED)
  486. include(CPackComponent)
  487. endif()
  488. if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED)
  489. include(CMakeParseArguments)
  490. endif()
  491. # Resolve full filename for script file
  492. macro(_cpack_ifw_resolve_script _variable)
  493. set(_ifw_script_macro ${_variable})
  494. set(_ifw_script_file ${${_ifw_script_macro}})
  495. if(DEFINED ${_ifw_script_macro})
  496. get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE)
  497. set(_ifw_script_file ${${_ifw_script_macro}})
  498. if(NOT EXISTS ${_ifw_script_file})
  499. message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists")
  500. set(${_ifw_script_macro})
  501. endif()
  502. endif()
  503. endmacro()
  504. # Resolve full path to lisense file
  505. macro(_cpack_ifw_resolve_lisenses _variable)
  506. if(${_variable})
  507. set(_ifw_license_file FALSE)
  508. set(_ifw_licenses_fix)
  509. foreach(_ifw_licenses_arg ${${_variable}})
  510. if(_ifw_license_file)
  511. get_filename_component(_ifw_licenses_arg "${_ifw_licenses_arg}" ABSOLUTE)
  512. set(_ifw_license_file FALSE)
  513. else()
  514. set(_ifw_license_file TRUE)
  515. endif()
  516. list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}")
  517. endforeach(_ifw_licenses_arg)
  518. set(${_variable} "${_ifw_licenses_fix}")
  519. endif()
  520. endmacro()
  521. # Macro for configure component
  522. macro(cpack_ifw_configure_component compname)
  523. string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
  524. set(_IFW_OPT COMMON ESSENTIAL)
  525. set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
  526. set(_IFW_MULTI_ARGS DEPENDS LICENSES)
  527. cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  528. _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
  529. _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
  530. set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
  531. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  532. cpack_append_option_set_command(
  533. CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
  534. _CPACK_IFWCOMP_STR)
  535. endforeach()
  536. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  537. cpack_append_string_variable_set_command(
  538. CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
  539. _CPACK_IFWCOMP_STR)
  540. endforeach()
  541. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  542. cpack_append_variable_set_command(
  543. CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
  544. _CPACK_IFWCOMP_STR)
  545. endforeach()
  546. if(CPack_CMake_INCLUDED)
  547. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWCOMP_STR}")
  548. endif()
  549. endmacro()
  550. # Macro for configure group
  551. macro(cpack_ifw_configure_component_group grpname)
  552. string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
  553. set(_IFW_OPT)
  554. set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
  555. set(_IFW_MULTI_ARGS LICENSES)
  556. cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  557. _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
  558. _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
  559. set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
  560. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  561. cpack_append_string_variable_set_command(
  562. CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
  563. _CPACK_IFWGRP_STR)
  564. endforeach()
  565. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  566. cpack_append_variable_set_command(
  567. CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
  568. _CPACK_IFWGRP_STR)
  569. endforeach()
  570. if(CPack_CMake_INCLUDED)
  571. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWGRP_STR}")
  572. endif()
  573. endmacro()
  574. # Macro for adding repository
  575. macro(cpack_ifw_add_repository reponame)
  576. string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
  577. set(_IFW_OPT DISABLED)
  578. set(_IFW_ARGS URL USERNAME PASSWORD DISPLAY_NAME)
  579. set(_IFW_MULTI_ARGS)
  580. cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  581. set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\"\n")
  582. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  583. cpack_append_option_set_command(
  584. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  585. _CPACK_IFWREPO_STR)
  586. endforeach()
  587. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  588. cpack_append_string_variable_set_command(
  589. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  590. _CPACK_IFWREPO_STR)
  591. endforeach()
  592. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  593. cpack_append_variable_set_command(
  594. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  595. _CPACK_IFWREPO_STR)
  596. endforeach()
  597. list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
  598. set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
  599. if(CPack_CMake_INCLUDED)
  600. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
  601. endif()
  602. endmacro()
  603. # Macro for updating repository
  604. macro(cpack_ifw_update_repository reponame)
  605. string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
  606. set(_IFW_OPT ADD REMOVE REPLACE DISABLED)
  607. set(_IFW_ARGS URL OLD_URL NEW_URL USERNAME PASSWORD DISPLAY_NAME)
  608. set(_IFW_MULTI_ARGS)
  609. cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  610. set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\" update\n")
  611. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  612. cpack_append_option_set_command(
  613. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  614. _CPACK_IFWREPO_STR)
  615. endforeach()
  616. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  617. cpack_append_string_variable_set_command(
  618. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  619. _CPACK_IFWREPO_STR)
  620. endforeach()
  621. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  622. cpack_append_variable_set_command(
  623. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  624. _CPACK_IFWREPO_STR)
  625. endforeach()
  626. if(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_ADD
  627. OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REMOVE
  628. OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REPLACE)
  629. list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
  630. set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
  631. else()
  632. set(_CPACK_IFWREPO_STR)
  633. endif()
  634. if(CPack_CMake_INCLUDED AND _CPACK_IFWREPO_STR)
  635. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
  636. endif()
  637. endmacro()
  638. # Resolve package control script
  639. _cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
  640. endif() # NOT CPackIFW_CMake_INCLUDED