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

Export not transitive

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 1.4.4
    • None
    • Qbs 1.4.4
      QtCreator 3.6
      Qt 5.5
      Windows 10

    Description

      I have several projects which share common classes and therefore I’m about to change the project layout to reflect these dependencies by splitting it into components which are implemented as static libraries.

      For now I created one module 'io' which uses an Export block to export its include path. The module is depended upon by 'core'. 'Core' by itself is then depended upon by 'app', nothing special so far.

      The documentation of the Export item says that its properties are transitive but I get several errors from the compiler when compiling app that includes from core cannot be found. Looking at the compiler statement, the include path exported by io is not listed in the include paths. When adding the dependencies to io in app directly, everything works fine.

      Do I use the Export/Depends pairs wrong or is my overall layout bad.

      I changed the app-and-lib example of Qbs to reflect my layout for clarification.

      app
      |- main.cpp
      
      lib1
      |- lib.cpp
      
      lib2
      |- lib.cpp
      |- Test.h
      
      
      === app-and-lib.qbs
      import qbs 1.0
      
      Project {
          references: [
              "app/app.qbs",
              "lib1/lib1.qbs",
              "lib2/lib2.qbs"
          ]
      }
      
      === app.qbs
      import qbs 1.0
      
      Product {
          type: "application"
          name : "app-and-lib-app"
          files : [ "main.cpp" ]
          Depends { name: "cpp" }
          Depends { name: "lib1" }
      }
      
      === lib1.qbs
      import qbs 1.0
      
      Product {
          type: "staticlibrary"
          name: "lib1"
          files: [ "lib.cpp" ]
          cpp.defines: ['CRUCIAL_DEFINE']
          Depends { name: 'cpp' }
          Depends { name: "lib2" }
      }
      
      === lib2.qbs
      import qbs 1.0
      
      Product {
          type: "staticlibrary"
          name: "lib2"
          files: [
              "Test.h",
              "lib.cpp",
          ]
          cpp.defines: ['CRUCIAL_DEFINE']
          Depends { name: 'cpp' }
      
          Export {
            Depends { name: "cpp" }
            cpp.includePaths: "."
          }
      }
      
      === lib.cpp
      #include <stdio.h>
      #include "Test.h"
      
      
      #ifndef CRUCIAL_DEFINE
      #   error CRUCIAL_DEFINE not defined
      #endif
      
      int bla()
      {
          puts("Hello World!");
          return 2;
      }
      
      === main.cpp
      #include <stdio.h>
      #include "Test.h" // Error cannot found Test.h
      
      int bla();
      int main()
      {
        Test t = new Test();
          return bla();
      }
      

      Attachments

        Issue Links

          Activity

            People

              jbornema Joerg Bornemann
              andreaskuechler Andreas
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: