# ExternalNativeBuild

[View Source](https://cs.android.com/search?q=file:com/android/build/api/dsl/ExternalNativeBuild.kt+class:com.android.build.api.dsl.ExternalNativeBuild) Added in 4.2.0


```
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)

```
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 |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ExternalNativeBuild#cmake(kotlin.Function1)(action: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/Cmake.() -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` Per module settings, such as the path to `CMakeLists.txt`, for an external CMake project. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ExternalNativeBuild#ndkBuild(kotlin.Function1)(action: https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/NdkBuild.() -> https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)` Per module settings, such as the path to `Android.mk`, for an external ndk-build project. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/Cmake` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ExternalNativeBuild#cmake()` Per module settings, such as the path to `CMakeLists.txt`, for an external CMake project. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html>` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ExternalNativeBuild#experimentalProperties()` Additional per module experimental properties for C and C++. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/NdkBuild` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ExternalNativeBuild#ndkBuild()` Per module settings, such as the path to `Android.mk`, for an external ndk-build project. |

## Public functions

### cmake

Added in 4.2.0

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

Per module settings, such as the path to `CMakeLists.txt`, for an external CMake project.

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

### ndkBuild

Added in 4.2.0

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

Per module settings, such as the path to `Android.mk`, for an external ndk-build project.

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

## Public properties

### cmake

Added in 4.2.0

```
val cmake: Cmake
```

Per module settings, such as the path to `CMakeLists.txt`, for an external CMake project.

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

### experimentalProperties

Added in 7.3.0

```
val experimentalProperties: MutableMap<String, Any>
```

Additional per module experimental properties for C and C++.

### ndkBuild

Added in 4.2.0

```
val ndkBuild: NdkBuild
```

Per module settings, such as the path to `Android.mk`, for an external ndk-build project.

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