Thanks you, i think i have found good example.
import qbs
import QbsFunctions
Product {
Depends { name: "Qt.core" }
property string minimumQtVersion: "5.1.0"
condition: QbsFunctions.versionIsAtLeast(Qt.core.version,
minimumQtVersion)
}
On Thu, Mar 17, 2016 at 4:54 PM, Kandeler Christian <
[email protected]> wrote:
> 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=
> [email protected]> on behalf of dismine <[email protected]>
> *Sent:* Thursday, March 17, 2016 3:11 PM
> *To:* [email protected]
> *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
>
> _______________________________________________
> QBS mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/qbs
>
>
_______________________________________________
QBS mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs