[QBS] Populate includes path to other products

Andrey Anpilogov anpilog at gmail.com
Wed Jan 7 07:59:32 CET 2015


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150107/b0890146/attachment.html>


More information about the Qbs mailing list