Configuring Builds

Visual Studio uses the Project System to build C++ projects, where MSBuild provides the project file format and build framework. Qt VS Tools integrate with MSBuild to design and build Qt applications as Visual Studio projects.

Visual Studio uses .vcproj files to build projects, whereas Qt uses .pro files with qmake or CMakeLists.txt files with CMake. Qt VS Tools enable you to import .pro 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. Conversion to and from CMakeLists.txt files is currently not supported.

MSBuild Configurations

At very general level, MSBuild works 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

You can set property values for the project itself (project scope) or for a specific file in the project (file scope), either globally or locally:

  • Project scope properties are always global. For example, the project's output directory or target file name.
  • Properties that apply to source files can be global, in which case the same value applies to all files. For example, you can set the default compiler warning level globally at level 3.
  • You can override such a global, file-scope definition for a specific file by defining a local property with the same name. For example, compile one of the source files 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 VS Tools provide the MSBuild project system with a set of Qt-specific targets that describe how to use the appropriate Qt tools to process files such as moc headers.

"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 that Qt tools generate 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.