[QBS] Populate includes path to other products

Dmitry Volosnykh dmitry.volosnykh at gmail.com
Wed Jan 7 08:19:05 CET 2015


Andrey, I would suggest you to extract your "project" to a separate .qbs
file. So that your top-level qbs looks like below:

import qbs

Project {
    references: [
        "app/app.qbs",
        "lib/lib.qbs"
    ]
}

Then in the app.qbs do:

Depends { name: "lib" }

Such setup works for me.

PS. Don't know if mixing references with direct Product declarations is
good to go... Documentation says nothing about it.

On Wed, Jan 7, 2015 at 9:59 AM, Andrey Anpilogov <anpilog at gmail.com> wrote:

> Hi,
>
> I'm investigating qbs as possible replacement to Makefiles in my project.
> And it looks good except one thing: how to add include path from product
> to product?
>
> Let's take an example:
>
> project.qbs
> ---------------------------------------------
> import qbs 1.0
>
> Project {
>   references: [
>       "lib/build.qbs"
>   ]
>
>   Product {
>     name: "project"
>     type: "application"
>     files: "main.cpp"
>     Depends { name: "lib" }
>     Depends { name: "cpp" }
>   }
> }
> ---------------------------------------------
>
> lib/build.qbs
> ---------------------------------------------
> import qbs 1.0
>
> Product {
>    name: "lib"
>    type: "staticlibrary"
>
>    files: ["file1.cpp", "file2.cpp"]
>    cpp.includePaths: ["api", "ppi", "xdi"]
>    cpp.defines:          ["xxx", "zzz"]
>    cpp.cxxFlags:       ["xxx", "zzz"]
>    cpp.cFlags:           ["xxx", "zzz"]
>    cpp.commonCompilerFlags: ["-Os", "-gdwarf-2", "-Wall"]
>    cpp.linkerScripts: "xxx"
>    Depends { name: "cpp" }
> }
> ---------------------------------------------
>
> It's quite similar to qbs/examples/app-and-lib example.
> The problem is that project/main.cpp can't include headers from 'lib'
> folder due to qbs doesn't add any include path from product:lib.
> I've looked over docs and cpp profile and could not find anything better
> then manually add includes into application product:
>
> ---------------------------------------------
> import qbs 1.0
> Project {
>   references: [ "lib/build.qbs" ]
>
>   Product {
>     name: "project"
>     type: "application"
>     //...
>     cpp.includePaths: "lib"
>   }
> }
> ---------------------------------------------
>
> And it looks quite strange to me. If I add reference and make product
> depended from other product I would expect I can pass not only static
> libraries to dependant product but also headers path...
>
> Or there is some other approach?
>
> Regards.
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150107/22f16647/attachment.html>


More information about the Qbs mailing list