Managing Qt Versions

Introduction

If your environment has the right qmake binary in its PATH and is also set up properly for a matching toolchain, then you do not necessarily need a profile to build projects with a Qt dependency. Otherwise, you should create one:

qbs setup-qt /usr/bin/qmake myqt

This will create the myqt profile which can then be used on the command line:

qbs profile:myqt

Note: If the setup-toolchains command has found more than one toolchain, you will need to manually link your Qt profile to one of them, like this:

qbs config profiles.myqt.baseProfile <profile name>

Multiple Qt Builds

To support multiple Qt builds, or in fact any combination of related settings, you need to create several profiles. The following example illustrates how to set up three different profiles, each for a different Qt build:

qbs setup-qt ~/dev/qt/4.7/bin/qmake qt47
qbs setup-qt ~/dev/qt/4.8/bin/qmake qt48
qbs setup-qt ~/dev/qt/5.0/qtbase/bin/qmake qt5

You can set the default Qt build like this:

qbs config defaultProfile qt5

To choose a Qt build that is different from the default, use:

qbs build profile:qt48

You can set other properties in a profile (not just Qt ones), in the same way you override them from the command line. For example:

qbs setup-qt C:\Qt\5.0.0\qtbase\bin\qmake.exe qt5
qbs config profiles.qt5.qbs.architecture x86_64
qbs config profiles.qt5.baseProfile msvc2010

The last example uses the inheritance feature of profiles. All settings in the profile set as baseProfile are known in the derived profile as well. They can of course be overridden there.

© 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.