# ExternalNativeBuild


```
interface ExternalNativeBuild
```

<br />

*** ** * ** ***

DSL object to configure external native builds using [CMake](https://cmake.org/) or [ndk-build](https://developer.android.com/ndk/guides/build.html)  

```text
android {
    externalNativeBuild {
        // Encapsulates your CMake build configurations.
        // For ndk-build, instead use the ndkBuild block.
        cmake {
            // Specifies a path to your CMake build script that's
            // relative to the build.gradle file.
            path "CMakeLists.txt"
        }
    }
}
```

To learn more about including external native builds to your Android Studio projects, read [Add C and C++ Code to Your Project](https://developer.android.com/studio/projects/add-native-code.html)

## Summary

| ### Public functions ||
|---|---|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [cmake](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/ExternalNativeBuild#cmake(kotlin.Function1))`(action: (@`[ExtensionFunctionType](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html)` `[Cmake](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Cmake)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)?)` Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `CMakeLists.txt` build script and build output directory. |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [ndkBuild](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/ExternalNativeBuild#ndkBuild(kotlin.Function1))`(action: (@`[ExtensionFunctionType](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html)` `[NdkBuild](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/NdkBuild)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)?)` Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `Android.mk` build script and build output directory. |

| ### Public properties ||
|---|---|
| [Cmake](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Cmake) | [cmake](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/ExternalNativeBuild#cmake()) Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `CMakeLists.txt` build script and build output directory. |
| [NdkBuild](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/NdkBuild) | [ndkBuild](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/ExternalNativeBuild#ndkBuild()) Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `Android.mk` build script and build output directory. |

## Public functions

### cmake

```
fun cmake(action: (@ExtensionFunctionType Cmake.() -> Unit)?): Unit
```

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `CMakeLists.txt` build script and build output directory.

For more information about the properties you can configure in this block, see [Cmake](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Cmake)  

### ndkBuild

```
fun ndkBuild(action: (@ExtensionFunctionType NdkBuild.() -> Unit)?): Unit
```

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `Android.mk` build script and build output directory.

For more information about the properties you can configure in this block, see [NdkBuild](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/NdkBuild)

## Public properties

### cmake

```
val cmake: Cmake
```

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `CMakeLists.txt` build script and build output directory.

For more information about the properties you can configure in this block, see [Cmake](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Cmake)  

### ndkBuild

```
val ndkBuild: NdkBuild
```

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your `Android.mk` build script and build output directory.

For more information about the properties you can configure in this block, see [NdkBuild](https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/NdkBuild)