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

inconsistent behaviour of conditions in Group sections

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 1.2.0
    • 1.1.0
    • General
    • None
    • a40ce9ece006fa5748ead5879dfa41336337efe5

    Description

      According to the documentation of Properties (http://qt-project.org/doc/qbs-1.1/properties-item.html), the following part

      Properties {
        condition: qbs.targetOS.contains("windows")
        cpp.defines [ "ON_WINDOWS" ]
      }
      Properties {
        condition: qbs.targetOS.contains("linux")
        cpp.defines [ "ON_LINUX" ]
      }
      

      is equivalent to

      Properties {
      cpp.defines: {
        if (qbs.targetOS.contains("windows"))
          return ["ON_WINDOWS"];
        if (qbs.targetOS.contains("linux"))
          return ["ON_LINUX"];
        }
      }
      

      I expected the same beaviour for Group, but this is not the case. For example, I want to install a additional library, which are different files on Windows and Linux. In my case, the Windows file (.dll) exists on the Windows System, but not on the Linux system and the Linux file (.so) exists on the Linux System but not on the Windows System. If I have the following part in my qbs file it fails:

      Group {
        condition: qbs.targetOS.contains("linux")
        qbs.install: true
        files: [ "libSomething.so" ]
      }
      Group {
        condition: qbs.targetOS.contains("windows")
        qbs.install: true
        files: [ "something.dll" ]
      }
      

      In Windows, I get the error that the .so file does not exist and on Linux that the .dll not exists. But if I use the following syntax:

      Group {
        qbs.install: true
        files: {
          if (qbs.targetOS.contains("windows")) {
            return ["something.dll"]
          }
          if (qbs.targetOS.contains("linux")) {
            return ["libSomething.so"]
          }
      }
      

      it works, as expected, without errors. This means that the two versions are NOT equivalent. I think the body of a group with a false condition should be ignored by qbs.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            wojo Markus B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes