AUTOUIC.rst 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. AUTOUIC
  2. -------
  3. Should the target be processed with auto-uic (for Qt projects).
  4. ``AUTOUIC`` is a boolean specifying whether CMake will handle
  5. the Qt ``uic`` code generator automatically, i.e. without having to use
  6. commands like :module:`QT4_WRAP_UI() <FindQt4>`, `qt5_wrap_ui()`_, etc.
  7. Currently, Qt versions 4 to 6 are supported.
  8. .. _`qt5_wrap_ui()`: https://doc.qt.io/qt-5/qtwidgets-cmake-qt5-wrap-ui.html
  9. This property is initialized by the value of the :variable:`CMAKE_AUTOUIC`
  10. variable if it is set when a target is created.
  11. When this property is ``ON``, CMake will scan the header and source files at
  12. build time and invoke ``uic`` accordingly.
  13. Header and source file processing
  14. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  15. At build time, CMake scans each header and source file from the
  16. target's sources for include statements of the form
  17. .. code-block:: c++
  18. #include "ui_<ui_base>.h"
  19. Once such an include statement is found in a file, CMake searches for the
  20. ``uic`` input file ``<ui_base>.ui``
  21. - in the vicinity of the file and
  22. - in the :prop_tgt:`AUTOUIC_SEARCH_PATHS` of the target.
  23. If the ``<ui_base>.ui`` file was found, ``uic`` is called on it to generate
  24. ``ui_<ui_base>.h`` in the directory
  25. - ``<AUTOGEN_BUILD_DIR>/include`` for single configuration generators or in
  26. - ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>`` for
  27. :prop_gbl:`multi configuration <GENERATOR_IS_MULTI_CONFIG>` generators.
  28. Where ``<AUTOGEN_BUILD_DIR>`` is the value of the target property
  29. :prop_tgt:`AUTOGEN_BUILD_DIR`.
  30. The include directory is automatically added to the target's
  31. :prop_tgt:`INCLUDE_DIRECTORIES`.
  32. Modifiers
  33. ^^^^^^^^^
  34. :prop_tgt:`AUTOUIC_EXECUTABLE`:
  35. The ``uic`` executable will be detected automatically, but can be forced to
  36. a certain binary using this target property.
  37. :prop_tgt:`AUTOUIC_OPTIONS`:
  38. Additional command line options for ``uic`` can be set via this target
  39. property. The corresponding :prop_sf:`AUTOUIC_OPTIONS` source file property
  40. can be used to specify options to be applied only to a specific
  41. ``<base_name>.ui`` file.
  42. :prop_sf:`SKIP_AUTOUIC`:
  43. Source files can be excluded from ``AUTOUIC`` processing by setting
  44. this source file property.
  45. :prop_sf:`SKIP_AUTOGEN`:
  46. Source files can be excluded from :prop_tgt:`AUTOMOC`,
  47. ``AUTOUIC`` and :prop_tgt:`AUTORCC` processing by
  48. setting this source file property.
  49. :prop_gbl:`AUTOGEN_TARGETS_FOLDER`:
  50. This global property can be used to group :prop_tgt:`AUTOMOC`,
  51. ``AUTOUIC`` and :prop_tgt:`AUTORCC` targets together in an IDE,
  52. e.g. in MSVS.
  53. :variable:`CMAKE_GLOBAL_AUTOGEN_TARGET`:
  54. A global ``autogen`` target, that depends on all :prop_tgt:`AUTOMOC` or
  55. ``AUTOUIC`` generated :ref:`<ORIGIN>_autogen` targets in the project,
  56. will be generated when this variable is ``ON``.
  57. :prop_tgt:`AUTOGEN_PARALLEL`:
  58. This target property controls the number of ``moc`` or ``uic`` processes to
  59. start in parallel during builds.
  60. :prop_tgt:`AUTOGEN_COMMAND_LINE_LENGTH_MAX`:
  61. This target property controls the limit when to use response files for
  62. ``moc`` or ``uic`` processes on Windows.
  63. See the :manual:`cmake-qt(7)` manual for more information on using CMake
  64. with Qt.