Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
0.1
-
None
Description
If I declare a conditional dependency on a module, there is no way to set properties on it because it will error when the condition is false:
CppApplication { property bool shouldIncludeSubmod: false files: "main.cpp" Depends { condition: shouldIncludeSubmod // Assuming QBS-82 is fixed for this to work... name: "submod" } Properties { condition: shouldIncludeSubmod submod.someProperty: true // This errors because submod is not a valid identifier } }
D:\workitems\qbs-bugs\condDepProp>qbs -f dontIncludeSubmod.qbp Found project file D:\workitems\qbs-bugs\condDepProp\dontIncludeSubmod.qbp ERROR: D:\workitems\qbs-bugs\condDepProp\dontIncludeSubmod.qbp:16 Binding 'submod.someProperty' failed, no property 'submod' in the scope of CppApplication
See attached zip for sources. The same code with shouldIncludeSubmod set to true builds fine:
D:\workitems\qbs-bugs\condDepProp>qbs -f doIncludeSubmod.qbp Found project file D:\workitems\qbs-bugs\condDepProp\doIncludeSubmod.qbp loading project took: 31 ms build graph took: 0 ms for debug: - [hpp, application] doIncludeSubmod as debug Scanning for file dependencies... compiling main.cpp linking doIncludeSubmod.exe embedding manifest into doIncludeSubmod.exe Build done.
(Note I had to clean the build dir between these two commands because qbs doesn't like having multiple qbp files in one dir)
I guess this might be quite tricky to fix, but if a condition is allowed inside a Depends then setting properties on it seems a reasonable thing to want to do.