# ExternalNativeBuild

# 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  

<br />

```
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/8.13/com/android/build/api/dsl/ExternalNativeBuild#cmake(kotlin.Function1))`(action: `[Cmake](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/Cmake)`.() `->` `[Unit](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.             |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [ndkBuild](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/ExternalNativeBuild#ndkBuild(kotlin.Function1))`(action: `[NdkBuild](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/NdkBuild)`.() `->` `[Unit](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                                                                                                                           |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Cmake](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/Cmake)                                                                                                                                                                    | [cmake](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/ExternalNativeBuild#cmake()) Per module settings, such as the path to`CMakeLists.txt`, for an external CMake project.       |
| [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`>` | [experimentalProperties](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/ExternalNativeBuild#experimentalProperties()) Additional per module experimental properties for C and C++. |
| [NdkBuild](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/NdkBuild)                                                                                                                                                              | [ndkBuild](https://developer.android.com/reference/tools/gradle-api/8.13/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[Cmake](https://developer.android.com/reference/tools/gradle-api/8.13/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[NdkBuild](https://developer.android.com/reference/tools/gradle-api/8.13/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[Cmake](https://developer.android.com/reference/tools/gradle-api/8.13/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[NdkBuild](https://developer.android.com/reference/tools/gradle-api/8.13/com/android/build/api/dsl/NdkBuild).