[QBS] Qbs question about reusing properties and library path

Jake Petroules Jake.Petroules at qt.io
Thu Jul 14 16:23:55 CEST 2016

On Jul 13, 2016, at 10:54 PM, YangRong <sanjurohayami at hotmail.com<mailto:sanjurohayami at hotmail.com>> wrote:


I have two questions about qbs:
1. Anyone knows how to reuse a property string?

You can't reference properties like that (referring to your extended detail on http://stackoverflow.com/questions/38365877/qbs-qestion-about-library-relative-path-and-how-to-reuse-a-property-string). You'll need to use QML inheritance or import a JavaScript file. For example, you can put JS code into separate .js files and then import them.

    function planetsCorrectlyAligned()
        // implementation

    import qbs 1.0
    import "helpers.js" as Helpers

    Product {
        name: "myproject"
        Group {
            condition: Helpers.planetsCorrectlyAligned()
            file: "magic_hack.cpp"
        // ...

This syntax for this is detailed in the Qbs documentation at: https://doc.qt.io/qbs/language-introduction.html#reusing-project-file-code

2. I can not use a relative path in the cpp.dynamicLibraries nor cpp.staticLibraries. Do I have to use absolute path there?

Didn't I answer this question elsewhere?

for more details: I created a StackOverflow question:

Thanks for your help


Auckland, New Zealand
QBS mailing list
QBS at qt-project.org<mailto:QBS at qt-project.org>

Jake Petroules - jake.petroules at qt.io<mailto:jake.petroules at qt.io>
Consulting Services Engineer - The Qt Company
Qbs build tool evangelist - qbs.io<http://qbs.io>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20160714/ea6c3aba/attachment.html>

More information about the Qbs mailing list