# CppSourceSet

API Documentation: | `CppSourceSet`

Note: This class is incubating and may change in a future version of Gradle.

A set of C++ source files.

A C++ source set contains a set of source files, together with an optional set of exported header files.

    plugins {
        id 'cpp'
    }

    model {
        components {
            main(NativeLibrarySpec) {
                sources {
                    cpp {
                        source {
                            srcDirs "src/main/cpp", "src/shared/c++"
                            include "**/*.cpp"
                        }
                        exportedHeaders {
                            srcDirs "src/main/include", "src/shared/include"
                        }
                    }
                }
            }
        }
    }

### Properties

Property | Description
`exportedHeaders` | Incubating The headers as a directory set.
`libs` | Incubating The libraries that this source set requires.
`preCompiledHeader` | Incubating The pre-compiled header configured for this source set.
`source` | Incubating The source files.

### Methods

Method | Description
`lib(library)` | Incubating Adds a library that this source set requires. This method accepts the following types:

### Script blocks

No script blocks

### Property details

#### `SourceDirectorySet` `exportedHeaders` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The headers as a directory set.

#### ``Collection`<?>` `libs` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The libraries that this source set requires.

#### `String` `preCompiledHeader`

Note: This property is incubating and may change in a future version of Gradle.

The pre-compiled header configured for this source set.

#### `SourceDirectorySet` `source` (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The source files.

### Method details

#### `void` `lib`(`Object` library)

Note: This method is incubating and may change in a future version of Gradle.

Adds a library that this source set requires. This method accepts the following types:

- A `NativeLibrarySpec`
- A `NativeDependencySet`
- A `LanguageSourceSet`
- A `Map` containing the library selector.

The Map notation supports the following String attributes:

- project: the path to the project containing the library (optional, defaults to current project)
- library: the name of the library (required)
- linkage: the library linkage required ['shared'/'static'] (optional, defaults to 'shared')