Hello,
I think I have another possible issue that you may be aware of as well (or I am 
just missing something). The Export item is a great way to control what the 
items that use the Product that defined it recieve. While that direction works 
pretty well I have major problems using the properties defined inside the 
Export in the Product that defined it. E.g.:
 
Product {
    Export {
        Depends { name: "cpp" }
        cpp.includePaths: "include/"
    }
    cpp.defines: MY_SHARED_LIB
}
 
This will emit warning that I use "cpp" without depending on it (located on the Product). The same 
warning (located to Export) will happen when I put the Depends before Export. Now as per documentation to 
access the variable defined outside of Export one has to use "product.cpp." that seems to work but 
the value does not seem to be properly exported because the other module that depends on this one will not 
have access to the variable by default (as opposed to when both Depends { name: "cpp" } and the 
cpp.includePaths variable are in the Export.
 
Placing all cpp variables into the Export is not an option because as you can probably 
guess the define in the example handles import/export macros so it must NOT be defined 
but in the original Product. One solution is to use Another Depends { name: 
"cpp" } outside of Export but then everything that was set in the Export must 
be repeated outside of it for this other instance as well. Not to mention it looks pretty 
weird:
 
Product {
    Export {
        Depends { name: "cpp" }
        cpp.includePaths: "include/"
    }
    Depends { name: "cpp" }
    cpp.includePaths: "include/"
    cpp.defines: MY_SHARED_LIB
}
 
Another issue that is linked to this one and likely of the same cause (whether it is a (known) bug or WAD) 
that other Depends { name: "SomeOtherProduct" } or event Depends { name: "Qt"; 
submodules: "widgets"; } are NOT accessible in the same Product. E.g.:
 
Product {
    Export {
        Depends { name: "Qt.core" }
        Depends { name: "cpp" }
        cpp.includePaths: "include/"
    }
    cpp.defines: MY_SHARED_LIB
}
 
Will provide access to Qt Core to whomever Depends on that Product but it does 
NOT provide access to it to this Product itself. Again, a workaround is to 
Depend on it outside of Export as well. How am I supposed to set these 
properties as exportable while having them available inside the defining 
Product? Ideally without duplicating the same code which I find rather silly.
 
Some further observations regarding this is that if I wanted to expose what I have in Export to 
surrounding Product I would need to explicitely do it with "product." but when another 
product Depends on it the values are "magically" merged to it, e.g.:
 
Product {
    name: "ExportedProduct"
    Export {
        Depends { name: "Qt.core" }
        Depends { name: "cpp" }
        cpp.includePaths: "include/"
    }
    cpp.defines: MY_SHARED_LIB
}
 
Product {
    Depends { name: "cpp" }
    Depends { name: "ExportedProduct" }
    cpp.includePaths: "somePath/"
}
 
Unlike the defining product the importing product does not suffer from any clashes and have all the 
properties readily available without any need to explicitely merge them with its own - like you 
need to do in the defining Product - both "include/" and "somePath/" will be 
passed to the compiler for instance as do other properties. Qt.core will also be available .
 
Perhaps I am missing something important here.
 
Thanks and sorry for longish post!
Michael

_______________________________________________
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to