Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-87

Not possible to set properties on a conditionally-included Module

    XMLWordPrintable

Details

    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.

      Attachments

        1. condDepProp.zip
          2 kB
          Tom Sutcliffe
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            tomsci Tom Sutcliffe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes