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


Christian
--
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?

Hello,

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) {

                return(true)

            }

            greaterThan(QT_PATCH_VERSION, $$patch) {

                return(true)

            }

        }

        greaterThan(QT_MINOR_VERSION, $$min) {

            return(true)

        }

    }

    greaterThan(QT_MAJOR_VERSION, $$maj) {

        return(true)

    }

    return(false)

}

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,
Roman
-------------- 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