Hi,

I have a project with multiple sub projects and products and want to move it to embedded platforms, and thus I want to set compiler flags like mpcu, which should be the same for all products. I know I can do it through the QtCreator kit or the command line, but I'd like that to be commited so that everyone uses the same flags.

I didn't find a solution, other than defining a module (or product) which sets the flags and every product has to depend on. Is there another way? Should there be another way? Because adding it to every product is a bit tedious and error prone.


You are not the first person requesting this:
https://bugreports.qt.io/browse/QBS-733
https://bugreports.qt.io/browse/QBS-894

The only other proposal was to create a base product which sets the relevant flags or loads other modules and let all other products inherit from that. That's of coursre not viable if you use predefined extended products like CppApplication/QtApplication & friends.

Eventually I settled on having a buildconfig module in my projects that all products have to depend on. There is one important advantage with that approach:

Qbs modules can be implemented in several files in a module folder. When loading a module with name "buildconfig", Qbs tests the Qbs files in the "buildconfig" module folder until it finds one with a matching condition. If you are ever going to support multiple target platforms or toolchain types, then such a solution would scale well.

That solution breaks as soon as you include other Qbs projects that are not under your control as sub-projects.

I still find a global Preference item useful or a default-dependencies property in the project item that attaches a module dependency to all products.

Richard

_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

Reply via email to