- Qt Creator Documentation
- Add subprojects to projects
- Qt Creator 15.0.1

How To

# Add subprojects to projects

You can link your application to Qt libraries and other libraries, such as system libraries or your own libraries. Further, your own libraries might link to other libraries. To compile your project and benefit from services such as code completion and syntax highlighting, add the libraries to your project.

## Create subprojects

To create subprojects and add them to a project:

1. Right-click the project name in the Projects view to open the context menu, and select New Subproject.
2. Follow the instructions of the wizard to create a subproject.

## Add existing projects as subprojects

To add an existing project as a subproject:

1. Select Add Existing Projects in the context menu.
2. In the file browser dialog, locate your subproject.

## Create SUBDIRS projects for qmake

When you create a new project and select qmake as the build system, you can add it to another project as a subproject in the Project Management dialog. However, the root project must specify that qmake uses the `subdirs` template to build the project.

To create a root project:

1. Select File > New Project > Other Project > Subdirs Project > Choose.
2. On the Summary page, select Finish & Add Subproject to create the root project and to add another project, such as a C++ library.

The wizard creates a project file (.pro) that defines a `subdirs` template and the subproject that you add as a value of the SUBDIRS variable. It also adds all the necessary files for the subproject.

### Specify dependencies

To specify dependencies, use the Add Library wizard.

### Remove subprojects

To remove subprojects, right-click the project name in the Projects view, and select Remove Subproject in the context menu.

See also Creating Projects, Use project wizards, Add libraries to qmake projects, and Add libraries to CMake projects.

How To