Let's say I've downloaded some library xyz with headers and binaries and put it somewhere not in standard search paths. For each Product I can add the search paths and library to link to cpp.includePaths, cpp.libraryPaths, cpp.staticLibraries, etc.
Is there a better [standard] way to do this? If I'm building the library as part of my project it seems I can define the paths in an Exports item and then use a Depends item in each Product to automatically set the paths. This seems like a nice mechanism and I wonder if there isn't a way to use it for external dependencies as well.
The qbs docs are a little thin...
Thanks!
You would typically create your own module for xyz. You can add locations where QBS would search for modules and imports by setting the project's qbsSearchPaths-property. E.g. by setting it to "qbs" QBS would search for additional modules in the "qbs/modules" sub-directory of your project.
There you could place a file called "xyz.qbs" that would look like this:
import qbs
Module {
Depends { name: "cpp" }
property string xyzPath: "the/xyz/path"
cpp.includePaths: xyzPath + "/include"
cpp.libraryPath: xyzPath + "/lib"
cpp.staticLibraries: "xyz"
}
You could then use it by simply adding a Depend to your project:
import qbs
Project {
qbsSearchPaths: "qbs"
CppApplication {
name: "myApp"
files: "src/**"
Depends { name: "xyz" }
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With