CPackIFW.cmake 25 KB

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