Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
cccf7a64cb312e6dfb89343cc6087d43cdfeb427
Description
Compiling projects for embedded systems requires often lots of compiler flags. These flags might be very specific to each project, platform and toolchain. In projects with multiple products, I find myself often struggling with the definition of project-specific compiler flags.
Different solutions exist for that problem:
- Add common flags to toolchain profiles. While this approach seems natural for toolchain-specific properties, it fails when they become too project-specific. Maintaining toolchain profiles is also cumbersome when having multiple machines for development, test, and deployment.
- Create a shell wrapper script for qbs that assigns common module properties via command line. This feels actually more like a hack, but is quite efficient.
- Define custom properties in the project item and let each product assign these properties to the appropriate modules. This approach requires unnecessary work.
- Define a project-wide base product item with all common compiler flags and derive every product from that. Thanks to the Properties item, this solution is quite readable, but the base item is still somehow hidden.
- A combination of the previous two.
- ?
I find each approach tedious in its own way and therefore propose a Qbs item for project-wide module preferences. This would require the least effort while providing maximum transparency.
Such a Preferences item should provide at least the following properties:
- bool condition: If false, the preferences will not be applied.
- stringList profiles: The profiles to which which the preferences are applied.
Example:
Preferences { Affects { name : "cpp" } cpp.commonCompilerFlags : "blabla" }