Configuring Builds

In Visual Studio, C++ projects are built using the Project System, where MSBuild provides the project file format and build framework. Qt VS Tools make use of the extensibility of MSBuild to provide design-time and build-time integration of Qt in Visual Studio projects.

Qt uses .pro files with qmake to build projects, whereas Visual Studio uses .vcproj files. Qt VS Tools enables you to import Qt project files into Visual Studio and export them back into Qt build files. In addition, you can convert Qt VS Tools projects into a qmake project, or the other way around.

MSBuild Configurations

At very general level, MSBuild might be described as follows:

  • An MSBuild project consists of references to source files and descriptions of actions to take in order to process those source files that are called targets.
  • The build process runs in the context of a project configuration, such as Debug or Release. A project may contain any number of configurations.
  • Data associated to source files and the project itself is accessible through properties. MSBuild properties are name-value definitions, specified per configuration. That is, each configuration has its own set of property definitions.

"Diagram showing Visual Studio Project and MSBuild"

Properties

Properties may apply to the project itself or to a specific file in the project, and can be defined either globally or locally:

  • Project scope properties are always global. For example, the project's output directory or target file name.
  • Properties applied to source files can be defined globally, in which case the same value will apply to all files. For example, the default compiler warning level could be defined globally at level 3.
  • Such a global, file-scope definition may be overridden for a specific file by a locally defined property with the same name. For example, one of the source files needs to be compiled with warning level 4.
  • Global definitions are stored in the project file or imported from property sheet files.
  • Local property definitions are stored in the project file, within the associated source file references.

Qt Settings

Qt Visual Studio Tools integrate with the MSBuild project system by providing a set of Qt-specific targets that describe how to process files such as moc headers by using the appropriate Qt tools.

"Qt Project Settings"

Qt settings are fully-fledged project properties, which ensures that:

  • Changes in Qt settings are synchronized with all the other properties in the project.
  • You can specify Qt settings, such as Qt versions and modules, separately for each build configuration.
  • You can override compiler properties for files generated by Qt tools in project settings
  • You can share Qt settings within a team or organization by exporting and importing them to and from shared property sheet files (.props).

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.