Qt for Build Engineers

Qt from the build side: module structure, the moc/uic/rcc/qmlcachegen code generators and what they do to the build graph, qmake versus CMake in Qt 6, static builds, and LGPL as a build constraint.

Overview

Qt through a build engineer's eyes

Most Qt material is written for application developers. A build engineer needs a different model: Qt is a C++ framework with a mandatory code-generation phase, a plugin-based runtime that fails in a distinctive way when packaged wrong, and a dual-licensing model that constrains how you may link.

Every Qt build follows the same path. Your headers, .ui forms, .qrc resource manifests and .qml files go through Qt's generators (moc, uic, rcc and qmlcachegen), which write C++. That generated C++ is compiled and linked together with your own code, and what you ship is the application plus its plugins. The rest of this chapter follows that path from the generators to the shipped files.

Key concepts

  • Q_OBJECT and moc
  • CMAKE_AUTOMOC / AUTOUIC / AUTORCC
  • uic and rcc
  • qt_standard_project_setup
  • qt_add_executable
  • Namespaced Qt targets
  • Static versus shared Qt
  • LGPLv3 relinking obligation

Interview questions

  • Explain the moc pipeline end to end and what breaks when it goes wrong.
  • Write the CMakeLists.txt for a Qt 6 Widgets application and justify each command.
  • You inherit a Qt 5 qmake project and are asked to move it to Qt 6 with CMake. Plan it.
  • Static Qt versus shared Qt — walk through the build, deployment, and licensing consequences.
  • Which Qt modules does a given application actually need, and how do you find out?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio