Specify project contents | Qt Creator Documentation

- Qt Creator Documentation
- Specify project contents
- Qt Creator 17.0.1

How To

# Specify project contents

A project can have files that should be:

- Compiled or otherwise handled by the build
- Installed
- Not installed, but included in a source package created with `make dist`
- Not installed, nor be part of a source package, but still be known to Qt Creator

The Projects view shows all files that you declare to be part of the project in the project files. It sorts the files into categories by file type (.cpp, .h, .qrc, and so on). To display additional files, edit the project file. Alternatively, you can see all the files in a project directory in the File System view.

Declaring files as a part of the project also makes them visible to the locator and project-wide search.

## CMake Projects

When using CMake, you can specify additional files for a project by either adding them as sources or installing them.

In the CMakeLists.txt file, define the files as values of the target_sources command using the `PRIVATE` property, for example.

You can prevent CMake from handling some files, such as a .cpp file that should not be compiled. Use the set_property command and the HEADER_FILE_ONLY property to specify such files. For example:

     set_property(SOURCE "${files}" PROPERTY HEADER_FILE_ONLY ON)

Alternatively, to install the files, use the install command with the `FILES` or `DIRECTORY` property.

## qmake Projects

Use the following variables in the .pro file:

- `SOURCES` and `HEADERS` for files to compile
- `INSTALLS` for files to install
- `DISTFILES` for files to include in a source package
- `OTHER_FILES` for files to manage with Qt Creator without installing them or including them in source packages

For example, the following value includes text files in the source package:

     DISTFILES += *.txt

See also Creating Projects, Use project wizards, and Projects.

How To