[QBS] How to check minimal supported Qt version?

Kandeler Christian Christian.Kandeler at theqtcompany.com
Thu Mar 17 15:54:54 CET 2016

I usually just disable my product if a condition is not met:

    Product {

        Depends { name: "Qt.core" }

        condition: Qt.core.versionMajor >= 5


You could also throw an error there, but you normally don't want to, because you'd like to be able to open the project in an IDE anyway, even if it cannot be built.

For a more generic version number check, you'd write a JavaScript function. See for instance qbs-resources/imports/QbsFunctions/functions.js in the qbs sources.

Top-quoting courtesy of web interface

From: QBS <qbs-bounces+christian.kandeler=theqtcompany.com at qt-project.org> on behalf of dismine <dismine at gmail.com>
Sent: Thursday, March 17, 2016 3:11 PM
To: qbs at qt-project.org
Subject: [QBS] How to check minimal supported Qt version?


Yesterday i finally decided to start porting my project to qbs. I really like ideas behind qbs and feel that it worth time i'll spend on porting.

Can someone help me with my first problem? In qmake i write:

!minQtVersion(5, 0, 0) {

    message("Cannot build Valentina with Qt version $${QT_VERSION}.")

    error("Use at least Qt 5.0.0.")


Code for the function:

defineTest(minQtVersion) {

    maj = $$1

    min = $$2

    patch = $$3

    isEqual(QT_MAJOR_VERSION, $$maj) {

        isEqual(QT_MINOR_VERSION, $$min) {

            isEqual(QT_PATCH_VERSION, $$patch) {



            greaterThan(QT_PATCH_VERSION, $$patch) {




        greaterThan(QT_MINOR_VERSION, $$min) {




    greaterThan(QT_MAJOR_VERSION, $$maj) {





How can i repeat the same with qbs?

Of course, i can skip this part and go further, but i rather not if i can.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20160317/d7af9d1d/attachment.html>

More information about the Qbs mailing list