CppComponent (Gradle API 8.14)
Description: declaration: package: org.gradle.language.cpp, interface: CppComponent

Package org.gradle.language.cpp

# Interface CppComponent

All Superinterfaces:
  `ComponentWithBinaries`, `ComponentWithDependencies`, `ComponentWithTargetMachines`, `Named`, `SoftwareComponent`

All Known Subinterfaces:
  `CppApplication`, `CppLibrary`, `CppTestSuite`, `ProductionCppComponent`

public interface CppComponent extends ComponentWithBinaries, ComponentWithDependencies, ComponentWithTargetMachines
Configuration for a C++ component, such as a library or executable, defining the source files and private header directories that make up the component. Private headers are those that are visible only to the source files of the component.

A C++ component is composed of some C++ source files that are compiled and then linked into some binary.

An instance of this type is added as a project extension by the C++ plugins.

Since:
  4.2

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.gradle.api.Named

  `Named.Namer`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Property<String>`
  `getBaseName()`
  Specifies the base name for this component.
  `BinaryCollection<? extends CppBinary>`
  `getBinaries()`
  Returns the binaries for this library.
  `FileCollection`
  `getCppSource()`
  Returns the C++ source files of this component, as defined in `getSource()`.
  `FileTree`
  `getHeaderFiles()`
  Returns all header files of this component.
  `Configuration`
  `getImplementationDependencies()`
  Returns the implementation dependencies of this component.
  `FileCollection`
  `getPrivateHeaderDirs()`
  Returns the private header include directories of this component, as defined in `getPrivateHeaders()`.
  `ConfigurableFileCollection`
  `getPrivateHeaders()`
  Defines the private header file directories of this library.
  `ConfigurableFileCollection`
  `getSource()`
  Defines the source files or directories of this component.
  `void`
  `privateHeaders(Action<? super ConfigurableFileCollection> action)`
  Configures the private header directories for this component.
  `void`
  `source(Action<? super ConfigurableFileCollection> action)`
  Configures the source files or directories for this component.

  ### Methods inherited from interface org.gradle.language.ComponentWithDependencies

  `getDependencies`

  ### Methods inherited from interface org.gradle.language.ComponentWithTargetMachines

  `getTargetMachines`

  ### Methods inherited from interface org.gradle.api.Named

  `getName`

- ## Method Details

  - ### getBaseName

    Property<String> getBaseName()
    Specifies the base name for this component. This name is used to calculate various output file names. The default value is calculated from the project name.

  - ### getSource

    ConfigurableFileCollection getSource()
    Defines the source files or directories of this component. You can add files or directories to this collection. When a directory is added, all source files are included for compilation.

    When this collection is empty, the directory `src/main/cpp` is used by default.

  - ### source

    void source(Action<? super ConfigurableFileCollection> action)
    Configures the source files or directories for this component.

  - ### getCppSource

    FileCollection getCppSource()
    Returns the C++ source files of this component, as defined in `getSource()`.

  - ### getPrivateHeaders

    ConfigurableFileCollection getPrivateHeaders()
    Defines the private header file directories of this library.

    When this collection is empty, the directory `src/main/headers` is used by default.

  - ### privateHeaders

    void privateHeaders(Action<? super ConfigurableFileCollection> action)
    Configures the private header directories for this component.

  - ### getPrivateHeaderDirs

    FileCollection getPrivateHeaderDirs()
    Returns the private header include directories of this component, as defined in `getPrivateHeaders()`.

  - ### getHeaderFiles

    FileTree getHeaderFiles()
    Returns all header files of this component. Includes public and private header files.

  - ### getImplementationDependencies

    Configuration getImplementationDependencies()
    Returns the implementation dependencies of this component.

  - ### getBinaries

    BinaryCollection<? extends CppBinary> getBinaries()
    Returns the binaries for this library.
    Specified by:
      `getBinaries` in interface `ComponentWithBinaries`
    Since:
      4.5