Export Item
An Export
item can appear inside a Product Item. It defines a Module with the product's name that can be depended on by other products. The properties attached to the Export item will take effect in all products that depend on the product inside which the Export item is defined. As an example, consider these two products:
Product { name: "A" Export { Depends { name: "cpp" } cpp.includePaths: product.sourceDirectory cpp.defines: ["USING_" + product.name.toUpperCase()] } } Product { name: "B" Depends { name: "A" } }
The sources in product B will be able to use headers from product A without specifiying the full path to them, because the include path has been made known to the compiler via A's Export item. Additionally, product B will be compiled with the define USING_A
.
Note: This relationship is transitive, so a product C depending on product B will also get the include paths and preprocessor macros via A's Export item.
In contrast to Module items, product
within Export items refers to the product which defines the Export item. Use the importingProduct
variable to refer to the product that pulls in the resulting module.