CppSourceSet

Deprecated

The Gradle software model is deprecated and will be removed in Gradle 10. Use the new component model (e.g. cpp-application, cpp-library, swift-application, swift-library, xctest) instead.

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"
                    }
                }
            }
        }
    }
}

Since

1.9

Functions

Link copied to clipboard
abstract fun builtBy(tasks: Array<Any>)
Adds tasks required to build this component.
Link copied to clipboard
abstract fun generatedBy(generatorTask: Task)
Generated.
Link copied to clipboard
Returns a dependency which contains the tasks which build this artifact.
Link copied to clipboard
@Nullable
abstract fun getBuildTask(): @Nullable Task
Returns the task responsible for building this component.
Link copied to clipboard
abstract fun getDisplayName(): String
Returns a human-consumable display name for this element.
Link copied to clipboard
The headers as a directory set.
Link copied to clipboard
The headers that are private to this source set and implicitly available.
Link copied to clipboard
abstract fun getLibs(): Collection<out Any>
The libraries that this source set requires.
Link copied to clipboard
abstract fun getName(): String
Returns the name of this element.
Link copied to clipboard
@Nullable
abstract fun getParentName(): @Nullable String
Returns the parent name.
Link copied to clipboard
Returns the pre-compiled header configured for this source set.
Link copied to clipboard
abstract fun getProjectPath(): String
The path to the project containing this component.
Link copied to clipboard
The source files.
Link copied to clipboard
Returns whether build dependencies.
Link copied to clipboard
abstract fun lib(library: Any)
Adds a library that this source set requires.
Link copied to clipboard
abstract fun setBuildTask(@Nullable buildTask: @Nullable Task)
Specifies the task responsible for building this component.
Link copied to clipboard
abstract fun setPreCompiledHeader(header: String)
Sets the pre-compiled header to be used when compiling sources in this source set.