CPackIFW.cmake 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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. CPackIFW
  5. --------
  6. This module looks for the location of the command-line utilities supplied with the
  7. `Qt Installer Framework <http://doc.qt.io/qtinstallerframework/index.html>`_
  8. (QtIFW).
  9. The module also defines several commands to control the behavior of the
  10. :cpack_gen:`CPack IFW Generator`.
  11. Commands
  12. ^^^^^^^^
  13. The module defines the following commands:
  14. .. command:: cpack_ifw_configure_component
  15. Sets the arguments specific to the CPack IFW generator.
  16. ::
  17. cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
  18. [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
  19. [NAME <name>]
  20. [DISPLAY_NAME <display_name>] # Note: Internationalization supported
  21. [DESCRIPTION <description>] # Note: Internationalization supported
  22. [UPDATE_TEXT <update_text>]
  23. [VERSION <version>]
  24. [RELEASE_DATE <release_date>]
  25. [SCRIPT <script>]
  26. [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
  27. [DEPENDS|DEPENDENCIES <com_id> ...]
  28. [AUTO_DEPEND_ON <comp_id> ...]
  29. [LICENSES <display_name> <file_path> ...]
  30. [DEFAULT <value>]
  31. [USER_INTERFACES <file_path> <file_path> ...]
  32. [TRANSLATIONS <file_path> <file_path> ...]
  33. [REPLACES <comp_id> ...]
  34. [CHECKABLE <value>])
  35. This command should be called after :command:`cpack_add_component` command.
  36. ``COMMON``
  37. if set, then the component will be packaged and installed as part
  38. of a group to which it belongs.
  39. ``ESSENTIAL``
  40. if set, then the package manager stays disabled until that
  41. component is updated.
  42. ``VIRTUAL``
  43. if set, then the component will be hidden from the installer.
  44. It is a equivalent of the ``HIDDEN`` option from the
  45. :command:`cpack_add_component` command.
  46. ``FORCED_INSTALLATION``
  47. if set, then the component must always be installed.
  48. It is a equivalent of the ``REQUIRED`` option from the
  49. :command:`cpack_add_component` command.
  50. ``REQUIRES_ADMIN_RIGHTS``
  51. set it if the component needs to be installed with elevated permissions.
  52. ``NAME``
  53. is used to create domain-like identification for this component.
  54. By default used origin component name.
  55. ``DISPLAY_NAME``
  56. set to rewrite original name configured by
  57. :command:`cpack_add_component` command.
  58. ``DESCRIPTION``
  59. set to rewrite original description configured by
  60. :command:`cpack_add_component` command.
  61. ``UPDATE_TEXT``
  62. will be added to the component description if this is an update to
  63. the component.
  64. ``VERSION``
  65. is version of component.
  66. By default used :variable:`CPACK_PACKAGE_VERSION`.
  67. ``RELEASE_DATE``
  68. keep empty to auto generate.
  69. ``SCRIPT``
  70. is a relative or absolute path to operations script
  71. for this component.
  72. ``PRIORITY`` | ``SORTING_PRIORITY``
  73. is priority of the component in the tree.
  74. The ``PRIORITY`` option is deprecated and will be removed in a future
  75. version of CMake. Please use ``SORTING_PRIORITY`` option instead.
  76. ``DEPENDS`` | ``DEPENDENCIES``
  77. list of dependency component or component group identifiers in
  78. QtIFW style.
  79. ``AUTO_DEPEND_ON``
  80. list of identifiers of component or component group in QtIFW style
  81. that this component has an automatic dependency on.
  82. ``LICENSES``
  83. pair of <display_name> and <file_path> of license text for this
  84. component. You can specify more then one license.
  85. ``DEFAULT``
  86. Possible values are: TRUE, FALSE, and SCRIPT.
  87. Set to FALSE to disable the component in the installer or to SCRIPT
  88. to resolved during runtime (don't forget add the file of the script
  89. as a value of the ``SCRIPT`` option).
  90. ``USER_INTERFACES``
  91. is a list of <file_path> ('.ui' files) representing pages to load.
  92. ``TRANSLATIONS``
  93. is a list of <file_path> ('.qm' files) representing translations to load.
  94. ``REPLACES``
  95. list of identifiers of component or component group to replace.
  96. ``CHECKABLE``
  97. Possible values are: TRUE, FALSE.
  98. Set to FALSE if you want to hide the checkbox for an item.
  99. This is useful when only a few subcomponents should be selected
  100. instead of all.
  101. .. command:: cpack_ifw_configure_component_group
  102. Sets the arguments specific to the CPack IFW generator.
  103. ::
  104. cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
  105. [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
  106. [NAME <name>]
  107. [DISPLAY_NAME <display_name>] # Note: Internationalization supported
  108. [DESCRIPTION <description>] # Note: Internationalization supported
  109. [UPDATE_TEXT <update_text>]
  110. [VERSION <version>]
  111. [RELEASE_DATE <release_date>]
  112. [SCRIPT <script>]
  113. [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
  114. [DEPENDS|DEPENDENCIES <com_id> ...]
  115. [AUTO_DEPEND_ON <comp_id> ...]
  116. [LICENSES <display_name> <file_path> ...]
  117. [DEFAULT <value>]
  118. [USER_INTERFACES <file_path> <file_path> ...]
  119. [TRANSLATIONS <file_path> <file_path> ...]
  120. [REPLACES <comp_id> ...]
  121. [CHECKABLE <value>])
  122. This command should be called after :command:`cpack_add_component_group`
  123. command.
  124. ``VIRTUAL``
  125. if set, then the group will be hidden from the installer.
  126. Note that setting this on a root component does not work.
  127. ``FORCED_INSTALLATION``
  128. if set, then the group must always be installed.
  129. ``REQUIRES_ADMIN_RIGHTS``
  130. set it if the component group needs to be installed with elevated
  131. permissions.
  132. ``NAME``
  133. is used to create domain-like identification for this component group.
  134. By default used origin component group name.
  135. ``DISPLAY_NAME``
  136. set to rewrite original name configured by
  137. :command:`cpack_add_component_group` command.
  138. ``DESCRIPTION``
  139. set to rewrite original description configured by
  140. :command:`cpack_add_component_group` command.
  141. ``UPDATE_TEXT``
  142. will be added to the component group description if this is an update to
  143. the component group.
  144. ``VERSION``
  145. is version of component group.
  146. By default used :variable:`CPACK_PACKAGE_VERSION`.
  147. ``RELEASE_DATE``
  148. keep empty to auto generate.
  149. ``SCRIPT``
  150. is a relative or absolute path to operations script
  151. for this component group.
  152. ``PRIORITY`` | ``SORTING_PRIORITY``
  153. is priority of the component group in the tree.
  154. The ``PRIORITY`` option is deprecated and will be removed in a future
  155. version of CMake. Please use ``SORTING_PRIORITY`` option instead.
  156. ``DEPENDS`` | ``DEPENDENCIES``
  157. list of dependency component or component group identifiers in
  158. QtIFW style.
  159. ``AUTO_DEPEND_ON``
  160. list of identifiers of component or component group in QtIFW style
  161. that this component group has an automatic dependency on.
  162. ``LICENSES``
  163. pair of <display_name> and <file_path> of license text for this
  164. component group. You can specify more then one license.
  165. ``DEFAULT``
  166. Possible values are: TRUE, FALSE, and SCRIPT.
  167. Set to TRUE to preselect the group in the installer
  168. (this takes effect only on groups that have no visible child components)
  169. or to SCRIPT to resolved during runtime (don't forget add the file of
  170. the script as a value of the ``SCRIPT`` option).
  171. ``USER_INTERFACES``
  172. is a list of <file_path> ('.ui' files) representing pages to load.
  173. ``TRANSLATIONS``
  174. is a list of <file_path> ('.qm' files) representing translations to load.
  175. ``REPLACES``
  176. list of identifiers of component or component group to replace.
  177. ``CHECKABLE``
  178. Possible values are: TRUE, FALSE.
  179. Set to FALSE if you want to hide the checkbox for an item.
  180. This is useful when only a few subcomponents should be selected
  181. instead of all.
  182. .. command:: cpack_ifw_add_repository
  183. Add QtIFW specific remote repository to binary installer.
  184. ::
  185. cpack_ifw_add_repository(<reponame> [DISABLED]
  186. URL <url>
  187. [USERNAME <username>]
  188. [PASSWORD <password>]
  189. [DISPLAY_NAME <display_name>])
  190. This command will also add the <reponame> repository
  191. to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
  192. ``DISABLED``
  193. if set, then the repository will be disabled by default.
  194. ``URL``
  195. is points to a list of available components.
  196. ``USERNAME``
  197. is used as user on a protected repository.
  198. ``PASSWORD``
  199. is password to use on a protected repository.
  200. ``DISPLAY_NAME``
  201. is string to display instead of the URL.
  202. .. command:: cpack_ifw_update_repository
  203. Update QtIFW specific repository from remote repository.
  204. ::
  205. cpack_ifw_update_repository(<reponame>
  206. [[ADD|REMOVE] URL <url>]|
  207. [REPLACE OLD_URL <old_url> NEW_URL <new_url>]]
  208. [USERNAME <username>]
  209. [PASSWORD <password>]
  210. [DISPLAY_NAME <display_name>])
  211. This command will also add the <reponame> repository
  212. to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`.
  213. ``URL``
  214. is points to a list of available components.
  215. ``OLD_URL``
  216. is points to a list that will replaced.
  217. ``NEW_URL``
  218. is points to a list that will replace to.
  219. ``USERNAME``
  220. is used as user on a protected repository.
  221. ``PASSWORD``
  222. is password to use on a protected repository.
  223. ``DISPLAY_NAME``
  224. is string to display instead of the URL.
  225. .. command:: cpack_ifw_add_package_resources
  226. Add additional resources in the installer binary.
  227. ::
  228. cpack_ifw_add_package_resources(<file_path> <file_path> ...)
  229. This command will also add the specified files
  230. to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`.
  231. #]=======================================================================]
  232. # TODO:
  233. # All of the internal implementation CMake modules for other CPack generators
  234. # have been moved into the Internal/CPack directory. This one has not, because
  235. # it contains user-facing macros which would be lost if it were moved. At some
  236. # point, this module should be split into user-facing macros (which would live
  237. # in this module) and internal implementation details (which would live in
  238. # Internal/CPack/CPackIFW.cmake).
  239. #=============================================================================
  240. # Search Qt Installer Framework tools
  241. #=============================================================================
  242. # Default path
  243. foreach(_CPACK_IFW_PATH_VAR "CPACK_IFW_ROOT" "QTIFWDIR" "QTDIR")
  244. if(DEFINED ${_CPACK_IFW_PATH_VAR}
  245. AND NOT "${${_CPACK_IFW_PATH_VAR}}" STREQUAL "")
  246. list(APPEND _CPACK_IFW_PATHS "${${_CPACK_IFW_PATH_VAR}}")
  247. endif()
  248. if(NOT "$ENV{${_CPACK_IFW_PATH_VAR}}" STREQUAL "")
  249. list(APPEND _CPACK_IFW_PATHS "$ENV{${_CPACK_IFW_PATH_VAR}}")
  250. endif()
  251. endforeach()
  252. if(WIN32)
  253. list(APPEND _CPACK_IFW_PATHS
  254. "$ENV{HOMEDRIVE}/Qt"
  255. "C:/Qt")
  256. else()
  257. list(APPEND _CPACK_IFW_PATHS
  258. "$ENV{HOME}/Qt"
  259. "/opt/Qt")
  260. endif()
  261. list(REMOVE_DUPLICATES _CPACK_IFW_PATHS)
  262. set(_CPACK_IFW_PREFIXES
  263. # QtSDK
  264. "Tools/QtInstallerFramework/"
  265. # Second branch
  266. "QtIFW"
  267. # First branch
  268. "QtIFW-")
  269. set(_CPACK_IFW_VERSIONS
  270. "3.1"
  271. "3.1.0"
  272. "3.0"
  273. "3.0.0"
  274. "2.3"
  275. "2.3.0"
  276. "2.2"
  277. "2.2.0"
  278. "2.1"
  279. "2.1.0"
  280. "2.0"
  281. "2.0.5"
  282. "2.0.3"
  283. "2.0.2"
  284. "2.0.1"
  285. "2.0.0"
  286. "1.6"
  287. "1.6.0"
  288. "1.5"
  289. "1.5.0"
  290. "1.4"
  291. "1.4.0"
  292. "1.3"
  293. "1.3.0")
  294. set(_CPACK_IFW_SUFFIXES "bin")
  295. foreach(_CPACK_IFW_PREFIX ${_CPACK_IFW_PREFIXES})
  296. foreach(_CPACK_IFW_VERSION ${_CPACK_IFW_VERSIONS})
  297. list(APPEND
  298. _CPACK_IFW_SUFFIXES "${_CPACK_IFW_PREFIX}${_CPACK_IFW_VERSION}/bin")
  299. endforeach()
  300. endforeach()
  301. # Look for 'binarycreator'
  302. find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
  303. NAMES binarycreator
  304. PATHS ${_CPACK_IFW_PATHS}
  305. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  306. DOC "QtIFW binarycreator command line client")
  307. mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
  308. # Look for 'repogen'
  309. find_program(CPACK_IFW_REPOGEN_EXECUTABLE
  310. NAMES repogen
  311. PATHS ${_CPACK_IFW_PATHS}
  312. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  313. DOC "QtIFW repogen command line client"
  314. )
  315. mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
  316. # Look for 'installerbase'
  317. find_program(CPACK_IFW_INSTALLERBASE_EXECUTABLE
  318. NAMES installerbase
  319. PATHS ${_CPACK_IFW_PATHS}
  320. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  321. DOC "QtIFW installer executable base"
  322. )
  323. mark_as_advanced(CPACK_IFW_INSTALLERBASE_EXECUTABLE)
  324. # Look for 'devtool' (appeared in the second branch)
  325. find_program(CPACK_IFW_DEVTOOL_EXECUTABLE
  326. NAMES devtool
  327. PATHS ${_CPACK_IFW_PATHS}
  328. PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
  329. DOC "QtIFW devtool command line client"
  330. )
  331. mark_as_advanced(CPACK_IFW_DEVTOOL_EXECUTABLE)
  332. #
  333. ## Next code is included only once
  334. #
  335. if(NOT CPackIFW_CMake_INCLUDED)
  336. set(CPackIFW_CMake_INCLUDED 1)
  337. #=============================================================================
  338. # Framework version
  339. #=============================================================================
  340. set(CPACK_IFW_FRAMEWORK_VERSION_FORCED ""
  341. CACHE STRING "The forced version of used QtIFW tools")
  342. mark_as_advanced(CPACK_IFW_FRAMEWORK_VERSION_FORCED)
  343. set(CPACK_IFW_FRAMEWORK_VERSION_TIMEOUT 1
  344. CACHE STRING "The timeout to return QtIFW framework version string from \"installerbase\" executable")
  345. mark_as_advanced(CPACK_IFW_FRAMEWORK_VERSION_TIMEOUT)
  346. if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION_FORCED)
  347. set(CPACK_IFW_FRAMEWORK_VERSION)
  348. # Invoke version from "installerbase" executable
  349. foreach(_ifw_version_argument --framework-version --version)
  350. if(NOT CPACK_IFW_FRAMEWORK_VERSION)
  351. execute_process(COMMAND
  352. "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}" ${_ifw_version_argument}
  353. TIMEOUT ${CPACK_IFW_FRAMEWORK_VERSION_TIMEOUT}
  354. RESULT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION_RESULT
  355. OUTPUT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION_OUTPUT
  356. OUTPUT_STRIP_TRAILING_WHITESPACE
  357. ENCODING UTF8)
  358. if(NOT CPACK_IFW_FRAMEWORK_VERSION_RESULT AND CPACK_IFW_FRAMEWORK_VERSION_OUTPUT)
  359. string(REGEX MATCH "[0-9]+(\\.[0-9]+)*"
  360. CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION_OUTPUT}")
  361. if(CPACK_IFW_FRAMEWORK_VERSION)
  362. if("${_ifw_version_argument}" STREQUAL "--framework-version")
  363. set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "INSTALLERBASE_FRAMEWORK_VERSION")
  364. elseif("${_ifw_version_argument}" STREQUAL "--version")
  365. set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "INSTALLERBASE_FRAMEWORK_VERSION")
  366. endif()
  367. endif()
  368. endif()
  369. endif()
  370. endforeach()
  371. # Finally try to get version from executable path
  372. if(NOT CPACK_IFW_FRAMEWORK_VERSION)
  373. string(REGEX MATCH "[0-9]+(\\.[0-9]+)*"
  374. CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}")
  375. if(CPACK_IFW_FRAMEWORK_VERSION)
  376. set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "INSTALLERBASE_PATH")
  377. endif()
  378. endif()
  379. elseif(CPACK_IFW_FRAMEWORK_VERSION_FORCED)
  380. set(CPACK_IFW_FRAMEWORK_VERSION ${CPACK_IFW_FRAMEWORK_VERSION_FORCED})
  381. set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "FORCED")
  382. endif()
  383. if(CPACK_IFW_VERBOSE)
  384. if(CPACK_IFW_FRAMEWORK_VERSION AND CPACK_IFW_FRAMEWORK_VERSION_FORCED)
  385. message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} (forced) version")
  386. elseif(CPACK_IFW_FRAMEWORK_VERSION)
  387. message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} version")
  388. endif()
  389. endif()
  390. if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION)
  391. message(WARNING "Could not detect QtIFW tools version. Set used version to variable \"CPACK_IFW_FRAMEWORK_VERSION_FORCED\" manually.")
  392. endif()
  393. #=============================================================================
  394. # Macro definition
  395. #=============================================================================
  396. # Macro definition based on CPackComponent
  397. if(NOT CPackComponent_CMake_INCLUDED)
  398. include(CPackComponent)
  399. endif()
  400. # Resolve full filename for script file
  401. macro(_cpack_ifw_resolve_script _variable)
  402. set(_ifw_script_macro ${_variable})
  403. set(_ifw_script_file ${${_ifw_script_macro}})
  404. if(DEFINED ${_ifw_script_macro})
  405. get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE)
  406. set(_ifw_script_file ${${_ifw_script_macro}})
  407. if(NOT EXISTS ${_ifw_script_file})
  408. message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" does not exist")
  409. set(${_ifw_script_macro})
  410. endif()
  411. endif()
  412. endmacro()
  413. # Resolve full path to license file
  414. macro(_cpack_ifw_resolve_lisenses _variable)
  415. if(${_variable})
  416. set(_ifw_license_file FALSE)
  417. set(_ifw_licenses_fix)
  418. foreach(_ifw_licenses_arg ${${_variable}})
  419. if(_ifw_license_file)
  420. get_filename_component(_ifw_licenses_arg "${_ifw_licenses_arg}" ABSOLUTE)
  421. set(_ifw_license_file FALSE)
  422. else()
  423. set(_ifw_license_file TRUE)
  424. endif()
  425. list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}")
  426. endforeach(_ifw_licenses_arg)
  427. set(${_variable} "${_ifw_licenses_fix}")
  428. endif()
  429. endmacro()
  430. # Resolve full path to a list of provided files
  431. macro(_cpack_ifw_resolve_file_list _variable)
  432. if(${_variable})
  433. set(_ifw_list_fix)
  434. foreach(_ifw_file_arg ${${_variable}})
  435. get_filename_component(_ifw_file_arg "${_ifw_file_arg}" ABSOLUTE)
  436. if(EXISTS ${_ifw_file_arg})
  437. list(APPEND _ifw_list_fix "${_ifw_file_arg}")
  438. else()
  439. message(WARNING "CPack IFW: page file \"${_ifw_file_arg}\" does not exist. Skipping")
  440. endif()
  441. endforeach(_ifw_file_arg)
  442. set(${_variable} "${_ifw_list_fix}")
  443. endif()
  444. endmacro()
  445. # Macro for configure component
  446. macro(cpack_ifw_configure_component compname)
  447. string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
  448. set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
  449. set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT CHECKABLE)
  450. set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS REPLACES)
  451. cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  452. _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
  453. _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
  454. _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES)
  455. _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_TRANSLATIONS)
  456. set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
  457. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  458. cpack_append_option_set_command(
  459. CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
  460. _CPACK_IFWCOMP_STR)
  461. endforeach()
  462. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  463. cpack_append_string_variable_set_command(
  464. CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
  465. _CPACK_IFWCOMP_STR)
  466. endforeach()
  467. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  468. cpack_append_list_variable_set_command(
  469. CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
  470. _CPACK_IFWCOMP_STR)
  471. endforeach()
  472. if(CPack_CMake_INCLUDED)
  473. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWCOMP_STR}")
  474. endif()
  475. endmacro()
  476. # Macro for configure group
  477. macro(cpack_ifw_configure_component_group grpname)
  478. string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
  479. set(_IFW_OPT VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
  480. set(_IFW_ARGS NAME VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT CHECKABLE)
  481. set(_IFW_MULTI_ARGS DISPLAY_NAME DESCRIPTION DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS REPLACES)
  482. cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  483. _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
  484. _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
  485. _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES)
  486. _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_TRANSLATIONS)
  487. set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
  488. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  489. cpack_append_option_set_command(
  490. CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
  491. _CPACK_IFWGRP_STR)
  492. endforeach()
  493. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  494. cpack_append_string_variable_set_command(
  495. CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
  496. _CPACK_IFWGRP_STR)
  497. endforeach()
  498. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  499. cpack_append_list_variable_set_command(
  500. CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
  501. _CPACK_IFWGRP_STR)
  502. endforeach()
  503. if(CPack_CMake_INCLUDED)
  504. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWGRP_STR}")
  505. endif()
  506. endmacro()
  507. # Macro for adding repository
  508. macro(cpack_ifw_add_repository reponame)
  509. string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
  510. set(_IFW_OPT DISABLED)
  511. set(_IFW_ARGS URL USERNAME PASSWORD DISPLAY_NAME)
  512. set(_IFW_MULTI_ARGS)
  513. cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  514. set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\"\n")
  515. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  516. cpack_append_option_set_command(
  517. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  518. _CPACK_IFWREPO_STR)
  519. endforeach()
  520. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  521. cpack_append_string_variable_set_command(
  522. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  523. _CPACK_IFWREPO_STR)
  524. endforeach()
  525. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  526. cpack_append_variable_set_command(
  527. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  528. _CPACK_IFWREPO_STR)
  529. endforeach()
  530. list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
  531. string(APPEND _CPACK_IFWREPO_STR "list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
  532. if(CPack_CMake_INCLUDED)
  533. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
  534. endif()
  535. endmacro()
  536. # Macro for updating repository
  537. macro(cpack_ifw_update_repository reponame)
  538. string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
  539. set(_IFW_OPT ADD REMOVE REPLACE DISABLED)
  540. set(_IFW_ARGS URL OLD_URL NEW_URL USERNAME PASSWORD DISPLAY_NAME)
  541. set(_IFW_MULTI_ARGS)
  542. cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
  543. set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\" update\n")
  544. foreach(_IFW_ARG_NAME ${_IFW_OPT})
  545. cpack_append_option_set_command(
  546. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  547. _CPACK_IFWREPO_STR)
  548. endforeach()
  549. foreach(_IFW_ARG_NAME ${_IFW_ARGS})
  550. cpack_append_string_variable_set_command(
  551. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  552. _CPACK_IFWREPO_STR)
  553. endforeach()
  554. foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
  555. cpack_append_variable_set_command(
  556. CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
  557. _CPACK_IFWREPO_STR)
  558. endforeach()
  559. if(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_ADD
  560. OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REMOVE
  561. OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REPLACE)
  562. list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
  563. string(APPEND _CPACK_IFWREPO_STR "list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
  564. else()
  565. set(_CPACK_IFWREPO_STR)
  566. endif()
  567. if(CPack_CMake_INCLUDED AND _CPACK_IFWREPO_STR)
  568. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
  569. endif()
  570. endmacro()
  571. # Macro for adding resources
  572. macro(cpack_ifw_add_package_resources)
  573. set(_CPACK_IFW_PACKAGE_RESOURCES ${ARGV})
  574. _cpack_ifw_resolve_file_list(_CPACK_IFW_PACKAGE_RESOURCES)
  575. list(APPEND CPACK_IFW_PACKAGE_RESOURCES ${_CPACK_IFW_PACKAGE_RESOURCES})
  576. set(_CPACK_IFWQRC_STR "list(APPEND CPACK_IFW_PACKAGE_RESOURCES \"${_CPACK_IFW_PACKAGE_RESOURCES}\")\n")
  577. if(CPack_CMake_INCLUDED)
  578. file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWQRC_STR}")
  579. endif()
  580. endmacro()
  581. # Resolve package control script
  582. _cpack_ifw_resolve_script(CPACK_IFW_PACKAGE_CONTROL_SCRIPT)
  583. endif() # NOT CPackIFW_CMake_INCLUDED