[Qbs] Define the link order without an explicit dependency

Richard Weickelt richard at weickelt.de
Fri Aug 9 02:15:31 CEST 2019


Hello,

I have the following scenario:

    Product {
        name: "some-headers"
    }

    // Implementations of some-headers
    // A-1 and A-2 define the same symbols and are mutually exclusive.
    // An application product can only depend on one of them at a time
    StaticLibrary {
        name: "A-1"
        Depends { name: "some-headers" }
    }
    StaticLibrary {
        name: "A-2"
        Depends { name: "some-headers" }
    }

    // Can be linked to both, A-1/2
    // But it must always appear after A-1/2 on the linker command line
    // of a dependent application.
    StaticLibrary {
        name: "B"

        // Not sufficient to make B link after A-1/2
        Depends { name: "some-headers" }

        // Can not do that because it would make "app" link to both
        // A-1 and A-2 to app.
        // Depends { name: "A-1" }
        // Depends { name: "A-2" }
    }

    CppApplication {
        name: "app"

        // Selects one of A-1 or A-2, but never both
        Depends { name: "A-1" }
        Depends { name: "B" }
    }

Since I don't explicitly specify a dependency between A-1/2 and B, the link
order is undefined, i.e. B may appear before A-1/2. Is there any way to tell
Qbs that B must always appear after A-1/2 in the library list of app?

Thanks
Richard


More information about the Qbs mailing list