Module Item

A Module item is a collection of properties and language items that are used for building a product if the product depends on (or loads) the module.

A Module can be loaded by adding a dependency to it in a product. For example, the following product will load the cpp module. In addition, it will try to load modules that may or may not exist, and in the latter case use a fallback.

Product {
    Depends { name: "cpp" }
    Depends {
        name: "awesome_module"
        required: false
    }
    Depends {
        name: "adequate_module"
        condition: !awesome_module.present
        required: false
    }
    Depends {
        name: "crappy_module"
        condition: !awesome_module.present && !adequate_module.present
    }

    // ...
}
PropertyTypeDefaultDescription
presentbooltrueThis property is read-only. Its value is false if and only if the respective Depends item had its required property set to false and the module was not found.
setupBuildEnvironmentscriptundefinedScript for setting up the environment in which the project is built. Use the putEnv and getEnv functions to alter the environment. The return value of this script is ignored.
setupRunEnvironmentscriptsetupBuildEnvironmentScript for setting up the environment in which the project is run.
validatescriptundefinedScript that is run after the module is loaded. It can be used to check property values and throw errors in unexpected cases. The return value is ignored.