SubProject QML Type

Adds a project from a different file. More...

Import Statement: import QbsLanguageItems .

Properties

Detailed Description

A SubProject item is used to add a sub-project that is defined in a separate file. Additionally, properties of the sub-project can be set without modifying the separate project file.

The following example adds a sub-project defined in subdir/project.qbs and overrides its name.


  Project {
      SubProject {
          filePath: "subdir/project.qbs"
          Properties {
              name: "A sub-project"
          }
      }
      ...
  }

A typical use case for SubProject items is to conditionally include sub-projects. The following example pulls in the tests sub-project if and only if the withTests property is true.


  Project {
      property bool withTests: false
      SubProject {
          filePath: "tests/tests.qbs"
          Properties {
              condition: parent.withTests
          }
      }
      ...
  }

If you do not need to set any properties on the sub-project, you can also use the Project.references property, the same way you would for a product.


  Project {
      references: "subdir/project.qbs"
  }

is equivalent with


  Project {
      SubProject {
          filePath: "subdir/project.qbs"
      }
  }

It is also possible to nest Project items directly in the same file.

Property Documentation

filePath : path

The file path of the project to add as a sub-project. If the top-level item in this file is a Product, it gets wrapped automatically in a new project.

Default: empty


inheritProperties : bool

Determines whether the sub-project should inherit the properties of the surrounding Project. You can use this feature to share global settings between projects and sub-projects.

Default: true